Code Review Done The Right Way

103 12
Code reviews are one of these practices that we do all the time, but how to make sure they are really useful? What do you want to achieve by conducting a code review? Check if you completed the task correctly? Show how good you are? Discover bugs? See if anyone else agrees on your coding standards? For me the most important parts of a code review are to: 
  1. validate the design
  2. discover bugs
  3. share knowledge
Then how to conduct the review to achieve these three things? There is at least two major ways to do a review.
Online and offline.
Online, you let the author guide you through the code.
Offline, the author have to provide you with the code, and you have to walk through it yourself in order to provide any feedback.
 My experience is that online reviews only work for tiny changes, like for a few lines of code.
You always end up having the author guide you through the code, which in turn makes you miss the same bugs and design flaws that the author did.
Knowledge sharing is usually limited since you will miss most of the implementation details.
 So if someone asks you to do a review, and it has more than a few lines of code, make sure to do it offline.
If not doing it offline you end up spending a whole lot of time achieving noting related to validating the design, finding bug or achieving any knowledge sharing.
In such a case you are better off spending your time one something else.
Knowledge sharing  might be one of those areas that are forgotten the most as part of a code review.
Usually you will have a limited set of persons on the team developing a new feature.
 At some point you need to make sure that other persons on the same team, or another team, can manager to help out on that feature.
The author might get sick or for other reasons be unavailable.
To remove this risk you need to include several people in the review - at least two.
That way more developers will know about how the feature is implemented, and chances are those people will be able to quickly start working on that feature if needed.
  Reviews are also a great opportunity to train and educate new member on a team.
If you have any junior member or new persons on the team, make sure to include them regularly in the review process.
Not just by renewing their code, but by letting them review too.
 It will be a great learning experience for them, and most probably they will provide some really good feedback too.
 This enables them to learn a lot about the development practices at your company, and also learn about new features which they probably will work on later.
So to summarize; put aside time to do the review, do it offline and have more than one person doing the review.
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.