Back

Mastering Code Reviews: A Guide for Reviewers and Authors

If you ask a junior developer what their job is, they will say "writing code." If you ask a senior developer, they will say "solving problems." But if you ask a staff engineer, they might say "reading and reviewing code."

As you grow in your career, you will spend more time reading code than writing it. Code review is the single most important mechanism for maintaining code quality, sharing knowledge, and mentoring team members.

Yet, it is often a source of anxiety. Authors fear criticism; reviewers fear conflict. This guide explores how to turn code reviews from a painful chore into a superpower for your team.

The Philosophy: It's Not About You

The first rule of code review is: We are critiquing the code, not the person.

  • Bad: "You broke the build with this change."
  • Good: "This change seems to cause a build failure."

It sounds like a subtle semantic shift, but it changes the dynamic from accusation to collaboration.


For Authors: The Art of the Pull Request

A great code review starts before you open the PR. Your goal is to make the reviewer's job as easy as possible.

1. Context is King

Never open a PR with a blank description. At a minimum, include:

  • What does this change do?
  • Why is it necessary? (Link to the ticket/issue)
  • How was it tested? (Screenshots, videos, or CLI output)

2. The Goldilocks Size

A study by Cisco Systems found that a reviewer's ability to find defects drops significantly after reviewing 200-400 lines of code at a time.

  • Too Small: Fixing a typo (unless it's urgent).
  • Too Big: "Refactored the entire authentication system" (2,000 lines).
  • Just Right: One logical unit of work (e.g., "Add user login endpoint").

If your PR is too big, stack it. Break it down into smaller, dependent PRs.

3. Self-Review

Before assigning a reviewer, read your own diff. You will be amazed at how many silly mistakes (console.logs, commented-out code) you catch yourself. A clean diff shows respect for your reviewer's time.


For Reviewers: What to Look For

When you open a review, don't just look for missing semicolons. Think in layers.

Layer 1: Architecture and Design (The "Big Picture")

  • Does this change belong here?
  • Is it scalable?
  • Does it introduce technical debt?
  • Action: If the design is wrong, stop reviewing the details. Discuss the approach first.

Layer 2: Functionality and Bugs

  • Does it actually work?
  • Are edge cases handled? (Null checks, empty lists, error states)
  • Is there a security vulnerability? (SQL injection, XSS)

Layer 3: Readability and Maintainability

  • Are variable names descriptive? (x vs userIndex)
  • Is the logic too complex? (Nested loops, massive functions)
  • Will a developer six months from now understand this?

Layer 4: Style and Nits (The "Automated" Layer)

  • Indentation, spacing, brackets.
  • Pro Tip: Automate this with Prettier/ESLint. Humans shouldn't waste time arguing about commas.

The "Nitpick" Trap

We've all been there. You submit a complex algorithm, and the reviewer comments: "Please add a newline at the end of the file."

While style matters, focusing only on nits is demoralizing. It feels like bike-shedding.

The Rule of Thumb:
If a comment is purely subjective or a minor preference, label it as "Nit" or "Non-blocking".

"Nit: I prefer const here, but feel free to ignore."

This signals to the author: "I approve of your logic, this is just a polish suggestion."


Handling Disagreements

Disagreements are healthy. They mean people care. But they can turn toxic if mishandled.

  1. Ask Questions, Don't Give Orders:
    • Instead of: "Move this to a utility function."
    • Try: "What do you think about moving this to a utility function to improve reusability?"
  2. Hop on a Call:
    • If a comment thread goes back and forth more than 3 times, stop typing. Get on a video call or walk to their desk. Text is a terrible medium for nuance.
  3. Disagree and Commit:
    • Sometimes there is no "right" answer. If the author has a valid reason and it's not a critical issue, let them have it. Trust is more important than being 100% right.

Conclusion

Code review is a skill, just like coding. It requires empathy, clarity, and patience.

  • Authors: Write context-rich PRs and respect your reviewer's time.
  • Reviewers: Look for architectural issues first, be kind, and distinguish between "must-fix" and "nice-to-have."

When done right, code review doesn't just produce better code; it produces better engineers.

Soft SkillsCode ReviewEngineering CultureBest PracticesTeamwork

Explore Related Tools

Try these free developer tools from Pockit