Code Reviews: 5 Helpful Hints from Andersen

Jun 01, 2017
Blog

Code review is a powerful tool to achieve several important goals in software development process. At first, it’s what helps to improve the quality of your software. At second, it’s what keeps your code maintainable and clean. Also it gets new people up to speed and helps to spread the knowledge within the team.

But why do so many companies neglect it?
Why does every tenth developer consider it as a mere formality?
Should you really waste time on code reviews and why so?
And the main question: is it really useful for customers and helps their businesses?

This article will shed the light on all these questions and even more. We’ll tell you how to make your code reviews effective while keeping positive attitude to it.

Types of Code review

Depending on the way of realization:

Pre-commit. The code is reviewed before being committed to the main repository. It’s most informal way of code review implying that your colleague sits next to you and shares his comments on the go.

Post-commit. Takes place after the code has been submitted to the public repository. You can commit changes to the repository continuously. Other team members can view the code changes and plan their work accordingly.

Retrospective. Carried out by third-party teams/developers who haven’t been working on code review. It’s often used for internal projects, legacy projects or the ones, which reached a deadlock when a fresh eye is needed to find the solution, which the current team failed to find.

Depending on the level of details:

Superficial. Takes the least amount of time and basically performs the same functions as static code analyzer, therefore, it’s rarely performed manually.

Insightful. Takes more time as apart from constructions a developer needs to review their interaction as well as if the code is correct algorithmically.

Architectural. Most time-consuming type of code review which implies reviewing the architectural sequence of code within the entire application. Architectural code review takes approximately as much time as development itself, therefore, it’s carried out not so often.

 

Which type of code review to use and when

Most commonly we apply superficial pre-commit review using special tools.

Insightful post-commit code review is an essential part of every project. Among its advantages is that it ensures that all coding quality standards are met. If you make it a regular practice, in the long run, it will save lots of your development time.

Architectural retrospective code review is carried out after a great part of work has been already done. We check parts of the solution for compliance with the overall architecture (provided that the remaining parts of the solution were not involved in the development of this part). Moreover, by applying micro services you can realize architectural code review with lesser efforts.

 

What gives you code review

Quality. Code reviews help you find and fix bugs, architectural errors and business logic flaws at an early stage of a project which eventually saves your development time and thus the money.

Uniformity. Following coding standards is a practice you never should ignore if you want to deliver an easily maintainable code. And code reviews reveal badly written parts and keep the entire solution up to par.

Maintainability. Code reviews ensure that all the solution follows a single line. Thus a part of the functionality that has been developed by one person can easily and quickly be undertaken by another person.

Communication. Effectively done code reviews improves communication within the team and serve as a great way to learn and adopt best practices from your colleagues.

Estimation. Regular code reviews allow you to improve your development process as knowing the avg review time, acceptable defect rates, etc. help you better predict the outcome and give a more precise estimation.

 

How to make code reviews effective

  1. Follow the schedule. Try to never postpone code reviews. Delaying code reviews may eventually cost you a significant loss of time you’ll need to fix all hidden bugs and badly written parts. So, keep it on time.
  2. Make clear comments. Whichever comments you make when reviewing code of your colleagues, use simple, understandable language.
  3. Take it as normal. Some developers may take offense on the comments they get after code review. It further leads to motivation decline and low productivity. To avoid this you need to cultivate the right attitude to code reviews within your team. It’s a normal practice which exists to help people learn and become better and not in any case as the instance to hurt somebody.
  4. Involve at least 2 reviews. The more people you involve in code review the better impact it would have on a project. On one hand, a developer whose code is reviewed makes sure that comments on his work are objective. On the other hand, if one of the reviewers misses something the other one will back it up.
  5. Share the responsibility. Code review should be not just for senior team members. If you make it happen across the team involving both senior and less experienced developers, you’ll let each member of the team feel equally important.

Business Benefits

All was written above is dedicated to development team, not to the customer’s business. And now the time has come to describe all benefits that business gets using code review within it’s project.

  1. The team size increase becomes fairly simple and cheap. When your code is reviewed well all the team members are familiar with the whole project, and new ones can quickly stream into job.
  2. More than likely that no one software development company would say such. But well-reviewed and documented code opens the possibility to change the team relatively painless.
  3. Most of business-related risks become more predictable and less devastating in case of actuating. E. g. when the code is fully explored developers can find out and resolve any issue relatively fast.

Summing Up

Today code review is just one of the must-have tools we use to ensure the quality of projects we deliver to our clients. Years ago we mainly turned to occasional retrospective code reviews when problems on a project arose. Until we noticed that projects, where we applied for code reviews, come out more successful. Thus, we made it an indispensable part of the development process.

Not only has it resulted in the overall higher quality of software and fewer amount of bugs. We also managed to achieve better supportability of our software and increased code consistency. For the client, it means that the software he gets can be easily extended and supported further by his own or another third-party team. The code is well-documented, understandable and easy to work with.

What are your thoughts on code review? Let us know in the comments.

Previous articleNext article