NH-2,BYPASS,ROAD BHADWAR,VARANASI, PIN CODE 2213311
This article was adapted from a Google Tech on the Toilet (TotT) episode. You can download a printer-friendly version of this TotT episode and post it in your office.
By Saicharan Nimmala
When responding to code review comments, responses like “Done,” “Updated,” or “Fixed” are commonly used to indicate addressing a suggestion. However, sometimes, a little extra context adds a lot of clarity.
Next time you resolve a code review comment, ask yourself: “Is how I addressed the comment completely obvious from the code change and comment thread?” If not, supplement your response with a brief note to clarify the “why” or “how.” Your reviewers will thank you.
When is it helpful to add context to a code review comment response? Here are a few examples:
| Reviewer: | This approach seems risky. It might not handle all the edge cases properly. | |
| Less helpful response: | More helpful response: | |
| Author: | Updated. | Good catch. I’ve added checks for null, empty, and negative inputs, each with a new test case. Thanks! |
| Reviewer: | Consider using a more performant library for this data transformation. | |
| Less helpful response: | More helpful response: | |
| Author: | I’ll go with Y. | Done. I considered Library X, but stuck with Library Y because our datasets here are typically small, so the performance difference is negligible, and Library Y has a much simpler API. |
| Reviewer: | This logic seems a bit complex. Consider a simpler way to handle these. | |
| Less helpful response: | More helpful response: | |
| Author: | Fixed. | As we discussed offline, this complexity is required to maintain backward compatibility with legacy data formats. I’ve added a comment in the code to clarify this. Thanks! |
Learn more code review practices in Google’s code review guide: google.github.io/eng-practices/review.
Copyright by Heritage Nursing College 2023. Design & Developed By Sarthak Tech