Code review: what is checked?
A review is not a matter of taste and not a ritual. It is a second look at a change before it goes live — and it has a clear checklist.
What you will learn
The checklist, in this order
The order is not arbitrary. A review that starts at point six and never reaches points one to three has spent the expensive time on the cheap questions.
Every finding needs a failure scenario
This is the rule that keeps a review useful: whoever raises an objection names a concrete input and the concrete wrong behaviour that follows from it — or a named rule that is being violated.
“I would do this differently” is not a finding. “With a quantity of 0, this line divides by zero, and the interface then shows an empty page instead of a message” is one. The difference decides whether a review finds bugs or generates discussions.
It also follows that a review without findings is the expected normal outcome, not a sign of carelessness. Anyone who has to find something in every review will eventually find matters of taste.
A real-world example
A finding that prevented a release
A change was meant to add a filter to a list. In the review it became apparent that the filter bypassed the permission check: anyone who opened the address with a particular parameter saw records from other departments. This was not reachable through the interface, but it was through the address bar.
The finding was described in two sentences, with the exact address and the result. The fix took twenty minutes. Without the second look it would have come after the first incident — under different circumstances.
What a review cannot do
That is why our rule is: one change per topic, reviewable in one pass. Anyone who packs three topics into one change gets a review of the first.
Common misconceptions
About the author
Fabian Lücker is managing partner of PHP-Schmiede KG in Rheine and has worked in software development since 2007. He is responsible for development and design, and writes here about decisions that come up in real projects.