Sub topic 14
Review practices that work
This chapter assumes you can open a pull request, leave line comments, and submit a review verdict. It covers habits that make reviews faster and more useful for both the author and the reviewer.
Keep pull requests small
Review quality drops as the diff grows. A reviewer who sees 80 changed lines reads each one. A reviewer who sees 2,000 lines skims and approves. Aim for one logical change per pull request, and split refactors from behavior changes so each diff has a single purpose.
Practical ways to shrink a change:
- Land preparatory work, such as renames or file moves, in a separate pull request first.
- Put new behavior behind a flag so partial work can merge safely.
- Open a draft pull request early when you want direction before the code is finished.
Make the description do the work
A reviewer should not have to guess what to look for. The description from the previous chapters answers three questions: what changed, why, and how to test it. Point out the parts you are unsure about. A line such as "I'm not sure the retry logic handles a closed connection" directs attention where it is most valuable.
Review in a sensible order
- Read the title, description, and linked issue to understand the goal.
- Check the tests first. They show the intended behavior.
- Read the diff for design problems: wrong abstraction, missing edge cases, security issues.
- Read it again for details such as naming and style.
Let automation handle formatting and lint rules. If a human comments on spacing, a check is missing from your CI.
Write comments that can be acted on
A good comment names the problem, gives a reason, and offers a way forward.
| Weak comment | Better comment |
|---|---|
| "This is wrong." | "This loops over `users` for every order, which makes it O(n·m). Could we build a lookup map first?" |
| "Why?" | "Can you explain why the timeout is 30s here? A comment in the code would help the next reader." |
| "Fix naming." | "Nit: `data` is vague. `pendingOrders` would say what it holds." |
Label the weight of a comment. Prefix minor points with nit: and questions with question:, so the author knows which ones block the merge. Use a suggested change for small fixes and save discussion for design.
Respond promptly and kindly
Slow reviews stall the author and push them to start new work, which makes the next round of context switching worse. Many teams agree on a response target, such as one business day. Reviewers should say what they checked ("Reviewed the API changes, didn't look at the migration"). Authors should reply to every thread, either with a fix or with a reason for disagreeing.
Know when to leave the thread
If a comment thread goes past two or three exchanges, move to a call or chat and post the outcome in the pull request. Record the decision so later readers can see why the code looks the way it does.
Exercise
A reviewer finds a misspelled variable name and also doubts that the chosen caching approach will scale. How should they write and label the two comments?
Show answer
Mark the spelling as a minor point, for example "nit: recieved should be received", ideally as a suggested change the author can apply in one click. Raise the caching concern as a separate, unprefixed comment that explains the scaling risk and proposes an alternative or asks a question. The labels tell the author that the nit is optional and the design concern needs resolving before merge.