The importance of good code reviews

I believe code reviews to be one of the most important things to improve your level of technical skill and advancing in your professional career. And because of its importance, I decided to write a quick post about it.

Negative experiences

More often than not, reviewees tend to have negative experiences associated with code reviews.

This can be caused by many things. It could be that the reviewer wanted to assert his superiority and -intentionally or unintentionally- humiliated the reviewee, making each 'mistake' into a personal attack. Maybe the code review was focused on the wrong things, like grammar in commenting sections. Or maybe the review was always focused on the bad things, making the reviewee feel more and more useless and becoming more and more afraid of writing basic code.

How we do code reviews is very important. I've seen cases where the reviewer -with the best intentions- makes a list of all the 'mistakes', sends an email to the entire team, and leaves it at that. This can be really brutal for a junior, who just got publicly humiliated and thrown to the wolves, without a chance to defend or explain him- or herself.

Yet code reviews are one of the best way to learn, advance and better your programming skills. So we should -and can- do bettter!

Why should we review code?

To make my point absolutely clear, there are only a few reasons why we do code reviews.

  • Improve the technical skills and self confidence of the reviewee
  • Improve the technical skills and self confidence of the reviewee
  • Improve the technical skills and self confidence of the reviewee
  • Improve the quality of the code
  • Ensure coding guidelines are followed

When should we review code?

I'm a firm believer in formalizing code reviews as a part in your development process. In an ideal world I would do reviews at the end of each sprint, with change sets as small as possible (smaller means easier review!).
You -or your PM ;)- could argue that this will result in higher development costs. Your entire dev-team will be unavailable for the duration of the review. But doing these formal meetings will improve the technical skills of the programmers, which also means the duration of the review will automatically decrease in time. There is absolutely everything to gain and nothing to lose when you take the time to do your reviews correctly!

You could also ask your developers to ask for code reviews within the TFS source control system. This approach puts the responsibility with your programmer though, which may or may not be the best idea.

How should we review code?

Do it in person! Make sure the reviewee has the opportunity to explain him- or herself. Preferably, let the reviewee go over his or her own changeset, explaining the why and what.

Don't criticize but simply show how to do better. Make sure everyone in the room understands why it can be done better, how it can be done better and that everyone is in agreement. Don't humiliate, crack down or be hard in any way. We all make mistakes and we all started from somewhere. Pay very close attention to how your reviewee responds to the feedback and try your best to adjust your communication style to his or her personality. Always treat your coworkers with respect!

Don't only talk about the bad parts of the code. There will be good stuff in there as well. Make sure you emphasize those and give credit when credit is due.

Don't waste time on stuff that can be automated. Code guidelines are important, but you can use multiple code quality tools to enforce them. You shouldn't ignore them completely, but just try to focus more on the critical and important parts; explain them, make them better and be done with them.

The goal

If you are able to do good code reviews there are many things to gain.

  • Reviewees, whatever their level of skill set, will get better in what they do.
  • There will be less frustration within your team.
  • Code quality will improve, which will lead to better maintainability and stability of your product.
  • Code guidelines can be enforced more easily.

You might enjoy


Visual Studio Code is an open source code editor developed by Microsoft for Windows, Linux and OS X. It…

I don't write that much about unit tests. I don't have that much experience with them. But I recently…

Tim Sommer

I'm a Web Developer with +7 years of experience in the .Net framework, with a focus on HTML5 and JavaScript.

Belgium, Antwerp
comments powered by Disqus
OWIC
Member of The Internet Defense League