Operations · Operations & process management

Code review process

Best for Early Startup to Startup

1SUBMIT2REVIEW3REVISE4APPROVE

Use it when

Every code change needs a second developer's approval before it merges, and reviews on your team are slow, inconsistent or argued over.

Skip it when

  • Two developers can write the change together at one machine. Use Pair programming, which reviews the code as it is written.
  • Merges keep breaking the shared build. Set up Continuous integration first, so every change arrives with a passing build and tests.
  • You need to decide which documents the team keeps for people outside the code. Use Agile documentation, which this feeds.
  • You need to find which part of delivery is slowest before changing how you review. Use DORA metrics for DevEx.

What to apply first and what to use instead are listed below.

Inputs

  • Change
    One self-contained change with its tests, usually around 100 lines, from the author's branch.
  • Change description
    What the change does and why, written by the author.
  • Style guide
    The team's written style guide for each language, which settles every style question it covers.
  • Reviewers
    One or more developers who own or know the code being changed, assigned by a code owners file or a team rota.
  • Automated check results
    Build, test and static analysis results for the change, from the CI service.
  • Approval rule
    The number of approvals each protected branch requires before a merge, from the repository settings.

Steps

  1. Have the author split the work into small self-contained changes with tests, write the description, and send each change once its automated checks pass.
  2. Respond within one business day, at a break in your own work. If you cannot review it fully, say when you will or suggest another reviewer.
  3. Read the description and check that the change makes sense at all. Then review the main files for design, and send any major design comment straight away.
  4. Go through the remaining files in order, checking function, complexity, tests, naming, comments and style. Mark each comment as required, Nit, Optional or FYI, and say why.
  5. Have the author answer every comment with a code change or a reply, and rewrite unclear code instead of explaining it in the review tool.
  6. Approve once the change clearly improves the health of the code, even if it is not perfect. If author and reviewer cannot agree, talk it through live, write the outcome on the change, and escalate to the tech lead if needed.

Output

An approved change merged with its review record, kept in the review tool for each change.

  • Change and description
  • Reviewers and approvals
  • Time to first response
  • Comments by label (required, Nit, Optional, FYI)
  • Rounds of review
  • Disagreements escalated and how they were settled
  • Merge date

Done when

  • Every merged change has the number of approvals its branch rule requires.
  • Every required comment is closed by a code change or a recorded reply.
  • Every comment that is not required carries a label.
  • The first reviewer response came within one business day.
  • Every escalated disagreement has its outcome written on the change.

Measure

Each month, track time to first review response, rounds of review per change, change size and the share of changes merged within a day of being sent. Watch defects found after merge in reviewed code. Compare with your own previous three months. It is working when responses arrive within a business day, changes get smaller, and defects after merge hold steady or fall.

Hypothetical example

Fernbrook's mobile team had changes waiting four days for review, and authors kept rewriting code over style preferences. The team made its language style guide the only authority on style and set a one-business-day response rule. One author split a 1,200-line login rewrite into six changes of about 150 lines each. A reviewer spotted a design problem in the first change within hours, before the rest were built on it. Reviewers began marking small points as Nit. After two months, the median first response had fallen to five hours, and most changes merged after a single round of comments.

Common mistakes

  • Holding a change until it is perfect. Approve once it improves the code's health, and mark polish points as Nit.
  • Reviewing a very large change line by line. Ask the author to split it into small self-contained changes.
  • Arguing over style the guide does not cover. Follow the style guide, and accept the author's choice where it is silent.
  • Commenting on the developer instead of the code. Describe the problem in the code and say why it matters.
  • Leaving a disagreement open in comments for days. Talk it through, record the result on the change, and escalate if needed.

Sources

Show all 7 sources

By company stage

  1. Pre-IdeaNot applicableThere is no code to review.
  2. IdeaUsefulReview helps catch errors in an MVP, but speed to first customers comes first.
  3. Early StartupCriticalQuality is needed to iterate on traction, and review keeps a growing codebase healthy.
  4. StartupCriticalMore engineers and leads make peer review essential to keep quality and share knowledge.
  5. GrowthUsefulReview is already a habit and adds value through standards across many teams.
  6. ScaleUsefulReview is established practice, and it supports quality across multiple products.
  7. EnterpriseUsefulReview is routine in engineering units and is useful but not a differentiator.

Apply first

Nothing. You can start here.

Use instead

  • Pair programming

    Two developers can write the change together at one machine. Use Pair programming, which reviews the code as it is written.

  • Continuous integration

    Merges keep breaking the shared build. Set up Continuous integration first, so every change arrives with a passing build and tests.

  • Agile documentation

    You need to decide which documents the team keeps for people outside the code. Use Agile documentation, which this feeds.

  • DORA metrics for DevEx

    You need to find which part of delivery is slowest before changing how you review. Use DORA metrics for DevEx.

Recommended resources

No sponsored resources on this framework yet. Sponsored listings would be labelled here, never in search.

Progress is not saved until you have an account. Create a free account