Code Reviews: Good idea, bad idea?

Series: practices November 04, 2012

Code reviews seem to be a relatively docile topic in software development.

The leading opinion is that code reviews are a good idea. Some organizations even go as far as to mandate peer code reviews as part of their capital-P Process.

Reviews are a tool that catches bugs and mistakes. They share domain knowledge and help to maintain quality standards. Code reviews provide an opportunity for mentoring, teaching, and strengthening a team.

Or at least they are supposed to…

When the gloves come off and the pressures of a real project set in, code reviews can take a turn for the worse.

Reviews are a tool that cause resentment and division. They give false confidence about the correctness of code and let people preach about their own personal coding standards. Code reviews are a chore that cause productivity-killing context switches for the team.

For any given team, the effectiveness of code reviews is somewhere in the middle — between an amicable silver bullet and a toxic team killer.

After some thought and discussion with a few co-workers, I think the key factors to successful code reviews are trust and training.

Team members have to trust that the feedback from a code review is not a personal attack or a judgment of their abilities. Reviewers need to trust that the recipient will not resent them if they offer suggestions for improvement.

The team needs to view code reviews as a chance for constant and constructive feedback, not as a vehicle for grading your teammates or making passive-aggressive comments.

And trust isn’t something that inherently exists when a team is formed.

But training on how to properly conduct a code review can help make sure the process is helping the team build trust.

For every project team I’ve been on, the process of learning how to do a code review was to have some of your code reviewed. Now you are ready to do code reviews for someone else! This approach leaves plenty of room for (mis)interpretation of how code reviews should be handled.

Teaching new developers how to give appropriate feedback and what things to look for will help them provide value to more experience developers. Guiding team leaders on when to back up from a review and identify teachable moments will strengthen the team’s trust and respect from one another.

So are code reviews a good idea or not?

It depends on your team’s willingness to put in the work to make them a positive tool. As with any development tool, just using it is not enough — you must be sure you are using it in the right way.

built with , Jekyll, and GitHub Pages — read the fine print