Code Review Best Practices

Chapter 1 · Practice 2 of 4

Settle arguments with facts, the style guide and engineering principles

From The standard for approving a change

Why it matters

Many review arguments are really about taste. Google's guide sets an order of authority that removes most of them:

  1. Technical facts and data beat opinions and personal preferences.
  2. The style guide is the absolute authority on style. Anything it does not cover is a matter of preference.
  3. Design should rest on engineering principles, not personal taste. If the author shows several approaches are equally valid, accept the author's choice.
  4. Consistency: when no other rule applies, ask the author to match the existing code, as long as that does not make code health worse.

If the code follows the style guide and the design is sound, "I would have written it differently" is not a reason to block. Say it as an optional suggestion, or say nothing.

Do

  • Point to the style guide section when you raise a style issue

Avoid

  • Blocking a change because it does not match how you would have written it