Overview

As developers design and code, they naturally get biased looking at their own code, hence, getting a pair of fresh eyes to get feedback is worthwhile. Code reviews are not easy, but you can firmly believe that the tool can improve your code.

Goals

The goal of a code review is to improve code for your group. Any step in this direction is great, and it is not a "developer vs. code reviewer" debate.

Problems

One of the fundamental problems is that written speech is difficult. It is difficult to interpret emotions, and easy to misinterpret the questions and concerns of another person on a code review.

Another problem with the code reviews is that a high percentage of the time the reviewers are focusing on whitespace issues and naming standards. This is not what a code review is intended for. Most of these need to be addressed by automated tools. For example, at Sibros, we have tools that would auto-format the code to comply with a lot of coding standards to take this tedious work out of the picture. We also have tools that prevent a commit if coding standard is not quite right. Well, this article is not meant to sell you this tool, and the message is that focus on the meat, not on the whitespace appearance of the code because this needs to be addressed by a tool automatically.

Being a good code reviewer is a skill that sometimes only experience can build. I was asked once from a young engineer about why he could not come up with same code review findings that I uncovered, and unfortunately I did not have a magic bullet to offer. I did, however, advise that that I had been doing code reviews for many years. And so do not take it harshly if your early reviews are not as great as they can be.

Usual Pitfalls

The natural instincts of a developer may lead to:

Think Positively

Code reviews provide un-biased feedback. When a developer designs code, there is a natural progression to the developer being biased by their own code. So taking the feedback very positively is going to help improve the code. Sure, it will take a little bit of effort to make changes and turn things around, but it would be worthwhile.

If there is code review feedback, then there is definitely something you as a developer can improve, and improvement should never be a debate. Try to give in most of the time because ultimately it will help improve your own code.

Tips

Become a Good Code Reviewer

As important it is to get reviews on your own code, it is equally important to leave feedback for others. Unfortunately, being a good code reviewer can take some time, and it is an acquired skill. You can create a plan, and participate in more and more code reviews to become good at it.

Once you get over the hesitation of leaving feedback, you will learn to acquire the important skill of being a good code reviewer. You may experience going through the following:

Code Review Categories

Code Approval's Responsibility

Beyond the code author, there is an inherent responsibility of domain owners to ensure that the code review objectives are met prior to giving approval. Also, do not forget the Sibros' steps to writing quality software.

References

Code Review Etiquette