Why Code Reviews Are Crucial For Product Quality
Code reviews are a system of peer reviews that involve developers looking over code that they didn’t write and providing feedback. At Clearbridge, code reviews are included in our cross-developer verification process that is part of every project we work on. This post is going to describe why we have code reviews ingrained in our process, the benefits it offers to both our team and to our clients, and how we perform code reviews.
The Benefits Of Code Reviews
Code reviews ensure that more than one developer is looking at the code, not just the developer who did the work. When you have a second pair of eyes reviewing the work, you can see mistakes that the original developer may not have caught. Code reviews function to minimize any defective, redundant, and poorly optimized code making its way into production, which leads to cleaner code and ultimately a better product.
The process of reviewing code allows developers to become more familiar with other parts of the code base, meaning they gain a more holistic understanding of the app, including how the specific features they are working on might affect other facets of the project. An ancillary benefit is exposing more team members to many different aspects of the project, allowing for the seamless transfer of knowledge and a better idea of what needs to be achieved.
Better knowledge transfer leads to more flexibility on the project team. If additional resources are needed, if a developer working on certain features is sick or on vacation, etc., the exposure to other areas of the project allows another member of the team to jump into things without having to start from scratch. As a result, you don’t lose velocity.
Every developer becomes inherently better and more knowledgeable as they gain more exposure to new technologies or different ways of thinking. Code reviews allow developers to learn from the ways other developers approached a problem or completed a task. They can apply these different approaches to future projects or tasks and acquire new skills as a result.
Shorter Development Cycles
It might seem like code reviews add another step to the development process, but they can actually help streamline development. With the exposure that developers get to other aspects of the project, they can discover other assets that already exist which can be used in the areas they are working on. This helps to eliminate duplicate work, reduce development time, and decrease technical debt.
Our Code Review Process
Along with unit testing, code reviews are part of our practice of cross-developer verification, which is always done before product verification. Here is how they are conducted:
- The developer working on that particular ticket writes the code and ensures that it meets the acceptance criteria
- Once this is completed, they pass that ticket for cross-development verification. The developer makes a pull request
- The code associated with that ticket is reviewed by another developer. The developer performing the code will also create unit tests as part of verification
- The reviewer accepts the pull request if the code meets quality standards and merges into the code base
- The ticket is then passed to the product team for final product verification (User Acceptance Testing, Business Acceptance Testing)
There may be some variation in process from company to company, but the function of code reviews remains the same. Ultimately, having code reviews built into your process offers significant benefits to your team (and clients), and leads to a stronger end product.