12 December 2012

Peer code review is better

In software development process code review plays very important role.

What is code review?
 
Code review brings other set of eyes to look into the code to determine what are the defects, whether it met the functionality specification or not, whether coding standards met and best design principles and patterns are implemented properly or not.


Wikipedia code review article says code review is often called as peer code review. But peer code review is more specific. 

What is peer code review?

Peer code review is also a code review but done by your peers.

Code review is crucial in nature for the success of the software development. But important question is who should do the code review? Or who should be better if done by one of your peer?
Should code review done by an architect? Or should it be done by your team/tech lead or review should it be one of your pear developer or it should it be somebody from outside of the context of your software development team?

These questions are important because we need effective code reviews for the successful software development, not just code review.

Now question is who can do the review effectively?

Let’s consider role by role. First consider Software Architect:

1. He/she will always looks the things from distance i.e. birds view. It’s very rare that they are aware of project's class relationship in terms inheritance, composition.etc

.It may be very true that they will be working on many technologies at the same point of time; So in given programming language they will not be aware of any ground details on new features.( e.g., may be Asp.net MVC 4 features, .NET 4.0 features). 

3. Other thing is that you need to educate architect on what is the functionality, complete list of code files, demo of the working stuff. These are all time consuming.

4. Not but not the least getting architects time is great difficulty.

So in my view, Architect may not be person if you want effective code review to reduce defects in the software.

Secondly now consider tech lead case:
Tech lead in the team is actually responsible for doing code review. But he or she can do that effectively? Let’s analyze.

Tech lead aware of functionality what a developer is trying to achieve, tech lead aware of project's class relationships, coding standards and will keep abreast of project's technology. So tech lead is good person to do the code review effectively. 

Agreed, tech lead is good person to do the review. But is he best to do the effective code review?

Tech leads will keep a good knowledge on programming language new features. But, in many teams tech lead will not often code because they will be pulled into many meetings. So if they don't have time to do the code review, then next question will they peacefully sit and does the proper code review?

My answer is maybe not. So tech lead is not the best person to do the code review.

Now consider peer developer doing proper code review.
In my view peer developer is the right person to do the code review.

1.
Peer developer is fully aware of the functionality on what team is trying to achieve. 

2. Peer developer is fully aware of project's code and coding standards being followed. He will be aware of programming language new features, etc.

3. Not but the least peer developer can sit calm do the best code review, because they have time. They will get free time because they will not be pulled into many meetings.

4. Other important point to consider is peer developers will eager to find loop-wholes in fellow developer code.
So peer code review will be very effective for software development.

So peer developer will do the review effectively.

But a caveat here is peer developer may not able to think completely in terms of design patterns  So if tech lead covers that gap by taking a review on design principles and patterns then it would be complete and effective code review.

Peer developer do code review in terms programming concepts and reducing defects. To complement that tech lead will do the review to ensure best design principle and patterns are followed and they are implemented correctly.

So peer code review is very important in getting effective code review to build great software product. End of the day software should speak for itself.

No comments:

Post a Comment