How To Give A Good Code Review

March 15, 2011

Chapter 8 – Open Teams

Stay positive. How you say something matters as much as what you say and giving a good code review is all about tone. When someone else presents their work to you they are in a vulnerable position. Try to make them feel a little more at ease. Ask questions instead of making statements. If something doesn’t look right, ask them why they did it that way instead of telling them they did it wrong.

Focus on content, not style. There is more than one way to solve every problem. If someone else’s solution is different than yours, take it as an opportunity to learn something new. If your team has code style standards you should help enforce them, but don’t penalize someone for solving a problem in a different way than you would have.

Don’t debug during the code review. When someone brings you code to be reviewed that code should already have been compiled and tested. A code review can be helpful in finding bugs, but it is primarily a place to discuss the implementation. Stay focused on understanding why the person made the changes they made and don’t try to be a human debugger.