Code Review
My guidelines & ideas about code review.
- Criticise the code, not the author (“There’s a bug here” vs. “You inserted a bug here”).
- Reach common agreement that people shouldn’t cling to code written (“sunk cost fallacy”).
- Don’t baby any particular piece of code. Code is cattle, not pets.
- Don’t use questions that invite discussion if you’re not inviting a discussion, instead expose the reason you believe something should be different (“Should this be like X?” vs. “I think this should be like X for reasons A, B, C.”). This avoids wasting time and reviews that turn into long discussions.
- Don’t give orders (“Do this”, “Do that”) to your colleagues, since they are not your employees, and it doesn’t help promote learning & growth by not exposing the reasoning behind the demand.
- Avoid bike-shedding about style/formatting/etc. If this is important where you work, automate with tools.
- Agree previously on what constitutes a non-passable review, if there’s such a process.