The Benefits of Code Review
The Benefits of Code Review
Two days ago, I reviewed a code
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.