Every line of code behind Google Search or YouTube was read and approved by at least one other engineer before it went in. That rule is called code review: you can't drop your code straight into the company's giant shared repository; a colleague has to look at it first. This chapter is about how Google does it, and what it really buys.
An analogy
Think of a newspaper. A reporter files a story and an editor reads it: the editor catches typos and checks facts, but more importantly makes sure readers will understand it. The section chief has to agree the piece belongs in their section, and a veteran copy editor checks it matches the paper's house style. All three can be the same person, but all three questions must be answered.
A strange thing first
Most people assume review is mainly for catching bugs. Yet Google's own research found the biggest payoffs are the invisible ones: making sure at least two people understand the code, keeping the whole company writing it the same way, and letting newcomers learn the ropes one review at a time. Catching bugs is just one item on the list.
Why the old world was hard
Code is written once but read and changed by many people for years. If only the author understands it, the moment the author changes teams it becomes a black box nobody dares to touch. With tens of thousands of people each writing their own way, the codebase slowly turns into a jumble.
How it works, intuitively
Keep changes small: hand in one page of homework, not the whole notebook, so a colleague can read it properly in half an hour instead of skimming.
Answer fast: don't leave the author waiting; reply by the next morning at the latest. A slow review hurts more than people think.
Three keys: a colleague confirms it is correct and understandable, the owner of that part of the code confirms it belongs there, and a language expert confirms it follows the house style.
About the code, not the person: code belongs to the team, not to one person; comments target the code and stay polite.
Let machines go first: formatting and common mistakes are checked automatically, so people only look at what machines can't judge.
What it buys you / how to choose
Should your team review code? If the code will live for years and more than one or two people maintain it, yes; the trick is to keep changes small and replies fast. The honest cost: review takes every engineer several hours a week, and when it's slow, people get frustrated waiting.
Remember it in one line
Review isn't about catching culprits; it's about making sure every line of code is understood by at least two people.
Want the full review flow, the three approvals (LGTM, owner, readability), the five benefits, the five best practices and how the four kinds of review differ? → Switch to the deep read
In one sentence
You think code review is the gate that catches bugs before launch; this chapter says it is first of all a mechanism for getting code understood by someone other than its author. Correctness is one benefit, but the bigger returns are comprehension, consistency, knowledge sharing and culture; and what keeps it workable for tens of thousands of engineers is small changes, fast replies, three distinct approvals and automating everything that can be automated.
Glossary
Change / CL: one modification headed into the codebase; Google calls it a CL (changelist), roughly a GitHub pull request.
Snapshot: a version of the code the author uploads for review; each round of edits uploads a new snapshot.
LGTM: "Looks Good To Me", the standard reply meaning "I've read it and I'm fine with it".
OWNERS file: a text file in a directory listing who is responsible for that code; owners can approve changes into it.
Readability: Google's per-language certification; holders can vouch for style and idiom in that language (see Chapter 8).
Monorepo: the whole company's code in one repository, where anyone may end up changing anyone else's code.
Static analysis: automated tools that read source code without running it and flag suspicious patterns.
Rollback: undoing a change that was already submitted, restoring the code to its previous state.
Where it sits
Second chapter of Part III, "Processes". It follows Chapter 8 on style guides (who enforces the rules by hand? review does) and leads into Chapter 10 on documentation and the testing chapters from Chapter 11; Chapter 19 later covers Critique, the tool that carries this process. Real-world counterpart: the pull-request workflow on any GitHub or GitLab project.
What problem this chapter solves
Tens of thousands of engineers change code in Google's single repository at the same time, and people move between teams often. The chapter opens with a counterintuitive stance: code is a liability, not an asset. Every extra line is future cost to read, change and debug; the real asset is the functionality the code provides. So adding code to the repository should be treated with the care of a long-term commitment.
What happens without review? Code only its author understands becomes an untouchable black box when the author leaves; styles diverge and the codebase gets harder to read; dangerous patterns and untested changes slip quietly into the mainline. But review has a price too: in Google's research engineers spend roughly 3 hours a week reviewing, and if the process is slow, changes are big and comments are harsh, it becomes a company-wide bottleneck. The chapter answers: what should review check, who approves, and how to do it without slowing tens of thousands of people down.
Core ideas, in depth
1. The flow: how a change reaches the mainline
Google's review flow is plain, much like a pull request:
The author writes a change, creates a snapshot in their workspace and uploads it to the review tool (Critique). Automated checks run first and leave comments; the author can self-review the diff.
The author mails it out to reviewers, who leave line-by-line comments. Comments come in two kinds: must-fix, and optional "nit" suggestions.
The author revises, uploads a new snapshot and replies to each comment, looping until everyone is satisfied.
Approval: a reviewer gives LGTM, and all three required approvals are in place.
Submit: only once every comment is resolved can the author commit the change to the mainline.
Figure 1 · The review flow for one change: the comment-and-revise loop may run several rounds; before submit, all three approvals must be in and every comment resolved.
2. Three approvals: ask three questions separately
The chapter's most distinctive design: getting a change in requires answers to three different questions, each tied to a kind of approval:
LGTM: is it correct and understandable? Given by another engineer who confirms the code does what it claims and that someone else can read it. This person needn't be an expert; often it's a teammate.
Owner approval: does it belong here? Given by someone in the directory's OWNERS file. Owners are responsible for the long-term health of that code and judge whether the change fits the module's direction.
Readability approval: does it follow the language's idioms? Given by someone with readability in that language, confirming it matches the style and best practices of Chapter 8.
Why split them? Because the three questions need different expertise: anyone can check understandability, module direction needs an owner, language idiom needs specially trained judgment. Split up, each person answers only for their question. In practice most changes don't need three people: one reviewer who holds all three qualifications can grant everything at once, and a typical change has a single reviewer. That keeps the gatekeeping complete without multiplying process cost by the number of questions.
Figure 2 · Three approvals: every question needs an answer, but the qualifications can stack in one person, so most changes need only one reviewer.
3. Five benefits: catching bugs is only one
Correctness: stop defects before they land; the earlier, the cheaper. But the chapter notes most correctness work belongs to tests and automated checks; review is a complement.
Comprehension: authors always think their own code is clear; the reviewer is the first "future reader". If they can't follow it, nobody later will. The chapter weighs this more than bug-finding.
Consistency: readability approval keeps the codebase uniform, which eases people moving around and tools rewriting code (echoing Chapter 8).
Psychological and cultural benefits: review signals that code belongs to the team, not the individual; it's also validation, since someone read your work carefully; and it gently corrects working in isolation.
Knowledge sharing: review is one of Google's main channels for spreading knowledge; newcomers learn idioms and system details from comments, and reviewers learn what's happening elsewhere by reading code.
4. Five best practices: keeping review fast at scale
Be polite and professional: comment on the code, not the person; if a reviewer has no substantive objection, they should defer to the author's approach rather than push their own preference; authors treat comments as improvements, not attacks, and respond to every one.
Write small changes: the most important one. Small changes are easy to read, easy to roll back, and get a real review. Google's engineering practices guide gives the scale: about 100 lines is usually reasonable, 1000 lines is usually too large.
Write good change descriptions: the first line says what changed in one sentence; the body says why. It becomes a lasting record in version history.
Keep reviewers to a minimum: one reviewer suffices for most changes; each extra reviewer adds diminishing returns but stacks up waiting time.
Automate where possible: formatting, static analysis and presubmit tests run before a human looks, so people only review what needs judgment.
5. Four kinds of review, four approaches
Greenfield code: deserves the most scrutiny. The design should have been reviewed before coding; the code review confirms the API matches the design, tests exist and an appropriate owner is set, because new code is a long-term liability once it lands.
Behavioral changes, improvements and optimizations: the bulk of changes. Ask whether it's really needed and tested; performance optimizations should come with benchmark data.
Bug fixes and rollbacks: keep a fix focused, without unrelated changes riding along, and add a test that reproduces the bug. Rollbacks should be quick; their job is to stop the bleeding.
Refactorings and large-scale changes (LSCs): often tool-generated and spanning hundreds or thousands of directories. A reviewer only needs to confirm the change is safe for their part of the code, not re-litigate the overall plan (expanded in Chapter 22).
Key trade-offs and choices
Table 1 · The knobs of code review: which way to turn them, and what it costs
Knob
Google's choice
The other end
Honest cost
Change size
Small and frequent (around a hundred lines)
Large and rare (a whole feature at once)
Work must be sliced finely; sometimes several dependent changes queue up
Reviewers
Usually one; qualifications stack
Many sign-offs
Risk of one person missing something; tests and automation backstop it
Response time
One business day at most
Whenever there's time
Reviewers get interrupted; they must balance focus and responsiveness
Timing
Mandatory pre-submit review
Review after submit, or not at all
Every change waits; in return the mainline has always passed two pairs of eyes
Bar
Approve once it clearly improves code health
Approve only when perfect
Acceptable-but-imperfect code gets in; in return authors aren't blocked
Table 2 · Who should answer which question
Question
Best gatekeeper
Why not someone else
Formatting, import order
Formatter
Humans are slow at it and it sparks arguments
Known dangerous patterns
Static analysis / presubmit
Mechanically decidable; machines are more consistent
Is the logic right and readable?
LGTM reviewer
Requires understanding intent, which tools can't do
Does it belong in this module?
OWNERS owner
Needs someone accountable for the module's long-term direction
Language idiom
Readability holder
Needs specially trained judgment
The rule of thumb: first take away everything a machine can decide, then let the fewest people answer what's left; the smaller the change, the cheaper and more careful the review. A ten-person team needn't copy the three approvals; one teammate's LGTM plus CI is enough. With hundreds of people and code that must live a decade, layered gatekeeping like owners and readability starts to pay off.
Why it matters / in real systems
Almost every company now reviews code through pull requests; this chapter supplies the "why", and how to keep review from becoming a bottleneck. GitHub's CODEOWNERS file and "require at least one approval" on protected branches are essentially OWNERS and LGTM by another name; Google open-source projects such as Chromium still use OWNERS files. Asked in an interview or design review "how do you ensure code quality?", the strong answer isn't "strict reviews" but "small changes + fast reviews + automation up front + clear ownership".
Industry evidence · publicly verifiable
Google · the senior principle: Google's public engineering practices guide says reviewers should favor approving a change once it "definitely improves the overall code health of the system being worked on, even if the CL isn't perfect", calling this "the senior principle among all of the code review guidelines"; it adds that there is no such thing as "perfect" code, only better code. google/eng-practices · The Standard of Code Review ↗
Google · one business day: the same guide states "One business day is the maximum time it should take to respond to a code review request", and proposes "LGTM with comments": approve when only minor issues remain, so the author doesn't wait another day for an LGTM. google/eng-practices · Speed of Code Reviews ↗
Google · the size of a small change: "100 lines is usually a reasonable size for a CL, and 1000 lines is usually too large", with the note that the number of files touched also counts toward size. google/eng-practices · Small CLs ↗
Google · why engineers really review: Sadowski et al., "Modern Code Review: A Case Study at Google" (ICSE SEIP 2018), surveyed review inside Google and found engineers cite education, maintaining norms, gatekeeping and accident prevention as motivations, not just finding defects; changes at Google are typically small, most have a single reviewer, and turnaround is fast. Paper: ICSE SEIP 2018 (text citation)
A view from Microsoft: Bacchelli and Bird, "Expectations, Outcomes, and Challenges of Modern Code Review" (ICSE 2013), found developers expect review to be mainly about finding defects, while what it actually yields is more knowledge transfer, team awareness and alternative solutions, corroborating the chapter's claim that catching bugs is only one benefit. Paper: ICSE 2013 (text citation)
Pitfalls and debates
"Review is mainly for catching bugs": a misconception. The chapter and both the Google and Microsoft studies point the same way: comprehension, consistency and knowledge spread are the bulk of the value. Expecting review to replace tests fails at both.
"The stricter, the better": wrong. Chasing perfection stalls changes for days; Google's bar is "approve once it's clearly better", handling small issues with optional comments or LGTM with comments.
"One big change is easier to review in one go": backwards. Reviewers can only skim a big change, so more slips through, and it's harder to roll back.
Reviewers treating preference as the standard. If the author's approach is reasonable and compliant, let it through; "I would have written it differently" as a reason to block is the most common source of friction.
More reviewers isn't safer. Multiple reviewers breed "someone else will check it", waiting time stacks up, and returns diminish.
Context limits. The three approvals rely on Google's monorepo, OWNERS system and readability program; copied into a small team they become pure process overhead. In open source, reviewers are volunteers, and "one business day" is hard to promise.
Key takeaways
① Code is a liability, not an asset, so every line must be understood and accepted by someone else before it lands.
② The flow: snapshot → mail out → comment / revise loop → approval → all comments resolved → submit.
③ Three approvals: LGTM (correct and clear), owner (belongs here), readability (idiomatic); one person can hold all three.
④ Five benefits: correctness, comprehension, consistency, psychological and cultural, knowledge sharing; bug-catching is only one.
⑤ Five practices: be polite and professional, write small changes, write good descriptions, minimize reviewers, automate what you can.
⑥ Scale: about 100 lines is fine, 1000 is too big; reply within one business day; most changes have one reviewer.
⑦ The bar: approve once code health clearly improves, don't chase perfection; respect the author's reasonable approach.
⑧ Four kinds of review: scrutinize greenfield code, check necessity and tests for behavior changes, keep bug fixes focused with a test, and for LSCs only confirm local safety.
⑨ Pitfalls: review can't replace tests; stricter and more reviewers aren't better; Google's three approvals assume Google's scale.