-
Principles
- Reviewers should favor approving a revision once it is in a state where it definitely improves the overall code health of the system being worked on, even if the revision isn't perfect.
- Technical facts and data overrule opinions and personal preferences.
-
Author
-
Revision
-
Self-contained, small
- Makes a minimal change that addresses just one thing.
- The system will continue to work after the revision is checked in
- Not so small that its implications are difficult to understand
- After automated checks (tests, style, other CI)
-
Good descriptions
- First line: Short summary of what is being done
- Body is informative
- Refactoring changes should not alter behavior and vice versa
-
Respond
- Don't be offended
- Reply to every comment
-
Reviewer
-
Prompt (within hours) and thorough
- Look at every line of code
- If you are not in the middle of a focused task, you should do a code review shortly after it comes in
-
One business day is the maximum time it should take to respond to a code review
- First thing the next morning
-
Areas
-
Design
- Most important
- Do the interactions of various pieces of code make sense
-
Purpose / Functionality
- Does it accomplish the author’s purpose
- Functions and classes should exist for a reason
- Thinking about edge cases, looking for concurrency problems
-
Parallel programming
- Deadlock or race conditions
-
Implementation / Complexity
- Think about how you would solve the problem
- Look for abstractions
- Think like an adversary
- Use libraries or existing product code
- Follow standard pattern
- Avoid dependencies
- Avoid over-engineering
-
Legibility and style
- Thinking about reading experience
- Code style
- Avoid TODOs
-
Maintainability
-
Read the tests
- Ask for unit, integration and end-to-end tests
- Naming
- Backward compatibility
-
Documentation and Comments
- Comments should explain why some code exists, not what some code is doing
- Documentation of class or functions should express the purpose of a piece of code
- Is the external documentation updated
-
Good Things
- Tell the developer if you see something nice
- Security
-
Comments
-
concise, friendly and actionable
- Balance giving explicit directions with just pointing out problems and letting the developer decide
- Explain your reasoning
- Encourage developers to simplify code or add code comments instead of just explaining the complexity to you
-
Steps
- 1. Take a broad view of the change
- 2. Examine the main parts of the CL
- 3. Look through the rest of CL in an appropriate sequence