Effective Code review or How to execute a Succesful code review

17 Sep

Code Review…. The dreaded words for a newbie ears ..or in most of the cases even for the experienced developers!!!!

How to code review ?
Over the years of being the code reviewer or me being the reviewee have noticed a few things which i feel are worth mentioning for an effective and pain free code review to happen.

What exactly is a code review i guess everybody knows that , ill try and point out some of the things which should be taken care of for a productive and pain free code review to happen.

  • Objective: Make sure the objective behind the code review is well known to the developers involved: Developers need to understand that the code is being reviewed and not the developers ability to code.
  • Coding Standard: Make sure you have a predefined set of coding standards circulated with the team before coding. Developers wont have any clue as to what you as a reviewer feel is the right coding standard unless they know what needs to be followed before they start coding.
  • Dont Accuse:Code review shouldn’t be used to accuse the coder, but to point out the improvement areas in the code.
  • Ask / Discuss: Ask reasons for deviation that have happened than assuming: Its better to let the developers explain the reason for deviation rather than assuming.Lets face it many time there are some theoretically correct statements which cant be possible practically.Hence ask reasons for deviation, understand the developers thought process.
  • Listen: Remember the coding approach you use isn’t like the ten commandments.Just because you feel reaching point C is better by going via point A not necessarily everybody will think the same.Let the developer explain why he felt going via point X was better as per him.
  • Understand: Remember the code review is about the coding style not about you.: Dont get offended if there are any improvement areas in your coding.Keep one thing in mind the person reviewing your code has also gone through the same phase as you currently.and till the time one understands the improvement areas we wont be able to improve and do coding expected by a seasoned developer.
  • Contribute: The coding standards wont contain all the development situations we face under the sun Hence contribution from the developer is absolutely necessary.Just because the person reviewing your code is a TL or PL doesn’t mean he is right all the time.Express your view, understand the reasons why there are improvement areas.Keep one thing in mind we do those things best in which we believe in!!! hence if you do not understand why we are doing certain thing in a certain expected way you will never do it correctly so discuss and understand.
  • Appreciate: Code review isn’t just about finding improvement areas. Utilize it also to appreciate someones coding style/Approach.
    Lets face it whether we like it or not we have to go in for code reviews some because their leaders make it mandatory while some because they understand the importance of code review.As long as code review happens in the right manner and for the right reasons it is always healthy for the complete team.

    Have seen or rather experienced developers who would argue over coding standard violation with pointless reasoning.reasoning that would be treated as childish excuses.Listen and explain to them anyways try and make them understand.Ofcourse in many cases you as a TL/PL need to put your foot down or do a little booting to make the developer sunderstand that crappy excuses wont be tolerated.

    Also one good thing to do beyond the coding standards document of what to do is to create a coding standard checklist for developers to check against as when they are coding.

    Copyright © Shounak Pandit

    These are my views, my thoughts need not necassarily be the same as yours…..


Tags: , , , , ,

2 responses to “Effective Code review or How to execute a Succesful code review

  1. Shaunak Pandit

    September 22, 2008 at 4:04 PM

    Thanks Michael!! nice to know some of my views were useful to you. 🙂 and best of luck in your role


  2. michael

    September 18, 2008 at 3:56 PM

    Shaunak Pandit, you have put forth some simple yet very important points in the post. Thanks for the pointers man,really helpful for me in my current role



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: