The Benefits of Code Review

August 29, 2008

5 comments

The Benefits of Code Review

Two days ago, I reviewed a code Code Review
of one of SRL’s employees as a part
of his ASP.NET training. The
employee got a training ASP.NET
tutorial that I wrote for SRL and
implemented a solution. The tutorial
gives high level details of what the
trainee need to implement and the
trainee need to implement all the
solution parts by himself/herself. 
So, why to bother and review a
trainee’s code? why to bother to
review code at all? In this post I’ll
try to answer these questions.

Code Review
Code review
is a process where one member of a team reviews other
member of the team’s code. I wrote “one member of the team” because
every experienced team member can and should review code and not only
the team leader or higher positions. The number of reviewers in code review
can be one or more (if you can afford it…). There are no strict guidelines to
code review but there are some that you should follow:

  • Defect free solutions.
  • The code meets the requirement.
  • The code follows industrial coding standards or your company’s standards.

The Benefits of Code Review
After we understand what is code review lets talk about what is its benefits:

  • Enforcing coding standards – by reviewing other developers code you can
    enforce industrial or company’s coding standards. Doing so will make the code
    more readable by the other developers in the team. In that way developers
    can work on code that someone else wrote and the code will be easier for them
    to read.
  • Mentoring tool – as I wrote in the example in the post’s start I perform code
    review
    as a way to help trainees to boost their development skills. The use
    of code review also can contribute to experience developers to see and learn
    other ways to develop (if you review other experienced developer’s code).
  • Better quality code – when you use code review process you can identify
    defects early in the development process. In that way the benefit is the cost 
    that you save to identify these errors when your application is in production
    or in late development step.
  • Wider project view – the developer that perform the code review can review
    places in the system that he/she never seen before. Sometimes, in big projects
    you build only one part of the solution. The code review can give the developers
    a wider sight on the project they participate in.
  • Better structured code – when a developer knows that someone will review 
    his/her code, the code that he/she write will be more documented and easier
    to read.

Probably there are more benefits and you can use the comments to add things that I
didn’t write.

Summary
The code review that I wrote about took almost one hour. In that hour I showed
the trainee where were his errors and suggested how to correct them. Also, I
pointed the places where he should improve his code. Things like documentation,
regions, error proof code, standards and more where part of my conclusions where
the trainee could improve. This example shows some of the benefits of code review
that include enforcing coding standards, finding defects and more. I think that
code review process is one of the building blocks of better software solutions and
should be integrated in every faze of the development process. 

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

5 comments

  1. JennyAugust 29, 2008 ב 9:49

    I agree with everything you said above. I find that having a group code review of seniors can also make sure the group is on the same page about certain stylistic issues (e.g. when to use checked exceptions versus unchecked exceptions in the case of Java).

    I also find it useful for junior developers to receive book suggestions of material to help them learn the next step as part of the code review. (The company hopefully has a program to also reimburse money for this book.) It could be a Design Patterns book, or maybe a book on a specific Best Practices technology, but whatever the junior developer should learn next to help develop his/her skills.

    As for what to address in a code review, I would refer to John Kelvie post on Effective Code Reviews: http://lightheatcode.com/?p=8

    Reply
  2. Gil FinkAugust 30, 2008 ב 2:09

    Thanks Jenny,
    I agree with what you wrote and I read John Kelvie post – Effective Code Reviews – and I recommanded to read it too.

    Reply
  3. xelonSeptember 3, 2008 ב 4:55

    Instead of Code Review process try to use Pair Programming. All in one solution 🙂

    Reply