How Code Review Works

Beginner
8 min read· Backend & Databases

Code review is the practice of having other engineers examine a change before it merges. Through a pull request, the author proposes a change, reviewers read it, ask questions, and suggest improvements, and once approved it merges. Done well, code review catches bugs early, keeps quality and consistency high, and — crucially — spreads knowledge across the team. Its effectiveness depends as much on culture and communication as on technical rigor: small changes, kind and specific feedback, and a shared goal of improving the code, not judging the author.

Think of an editor reviewing an article before publishing

A writer does not publish straight to print — an editor reads the draft, catches errors, questions unclear passages, and suggests improvements, and the piece is better for it. Code review is that editorial pass for software: a second set of eyes catches mistakes the author missed, improves clarity, and ensures it fits the publication standards. And like good editing, the aim is to improve the work, not to criticise the writer.

Step by Step

1 / 5

Key Concepts

Pull Request (PR)

A proposed change submitted for review before merging. It bundles the diff, a description, and a discussion thread, and is where automated checks and human review happen.

Small, Focused Changes

Small PRs are reviewed faster and more thoroughly than large ones. Reviewers give up on huge diffs, so keeping changes small and single-purpose dramatically improves review quality.

Constructive Feedback

Specific, kind comments about the code (not the author), that explain the reasoning and separate must-fix issues from optional suggestions. Tone determines whether review builds or erodes the team.

Knowledge Sharing

A major benefit beyond catching bugs: reviews spread understanding of the codebase across the team, mentor junior engineers, and reduce the risk of any one person being a single point of knowledge.

Key Facts

  • The biggest lever for good reviews is small pull requests — reviewers scrutinise a 50-line change carefully but skim a 2,000-line one.
  • Code review shares knowledge and mentors the team as much as it catches bugs, which is why even senior code benefits from review.
  • Feedback tone matters: comments should critique the code, not the person, and explain the why — a healthy review culture makes people want to submit work, not dread it.

Real-World Applications

Catching bugs before production

A reviewer notices an unhandled null case or a missing test in a pull request, and it is fixed before merge — far cheaper than discovering it as a production incident later.

Onboarding through review

A new engineer PRs get thoughtful review comments that teach the codebase conventions and design patterns, accelerating their ramp-up while keeping the code consistent.

Frequently Asked Questions

What is code review and why is it important?

Code review is the practice of having other engineers examine a proposed change — usually via a pull request — before it is merged. Reviewers check the change for correctness, clarity, design, edge cases, and tests, and suggest improvements. It is important because it catches bugs early when they are cheap to fix, keeps code quality and consistency high, and spreads knowledge of the codebase across the team, reducing the risk of any single person being the only one who understands a part of the system.

What should reviewers look for in a code review?

Reviewers check whether the change actually does what it claims and handles edge cases and errors, whether the code is readable and well-named, whether it fits the existing design and conventions, and whether it is adequately tested. They also consider security, performance where relevant, and maintainability. Importantly, reviewers focus on meaningful issues rather than nitpicking style that automated tools (linters, formatters) can catch, and they distinguish blocking problems from optional suggestions.

How do you give good code review feedback?

Make feedback specific, kind, and about the code rather than the person. Explain the reasoning behind a suggestion so the author learns, not just complies. Clearly separate must-fix issues from nice-to-have suggestions, ask questions when intent is unclear rather than assuming, and acknowledge good work. The tone of review comments strongly affects team morale and whether people embrace or resist the process, so treating review as a collaborative conversation aimed at improving the code — not a judgment of the author — is essential.

Why should pull requests be small?

Small pull requests get reviewed faster and far more thoroughly. Reviewers can carefully scrutinise a focused, 50-line change, but tend to skim or rubber-stamp a massive diff of thousands of lines because it is overwhelming — which lets bugs slip through. Small, single-purpose changes are also easier to understand, test, discuss, and revert if something goes wrong. Keeping PRs small is one of the highest-impact habits for effective code review.

Related Topics