In this blog series, we have covered the benefits and recommendations for development standards at your organization as well as the code quality and processes that can enable your team to perform at a higher standard. Code reviews are a development process, so we could have covered them in a prior blog. However, code reviews have a large enough scope and impact on your team that the topic needs its own blog (or two).
In this blog, I am going to discuss the benefits for organizing code reviews at your organization. The next blog, linked at the bottom, will cover code review best practices.
Benefits of a Code Review
One of the most important aspects of development is the code review process. Code reviews come in many forms, but the most common code review format is a peer evaluation. In this type of review, peers evaluate code and look for inconsistencies, bugs, errors, deviation from best practices, or security issues that could arise if the code was merged into the project’s main code branch. Peer reviews offer the following 5 important benefits not only to the development team but also to the overall project.
Developer Mentorship and Learning Opportunities
When onboarding new employees to a team, organizations often pair (or buddy) two colleagues together to help with onboarding. This same principle applies to code reviews. Through code reviews, senior technical members of the team provide feedback to newer team members, educating them about the project, helping them grow in their profession, and teaching them to write higher quality, more secure code. Reviews benefit every team member (not just the new ones) as every review participant is going to bring a different background and perspective to a problem, allowing the team to learn from each other and grow their knowledge organically. This is a welcome learning opportunity as it differs from the standard, learn-it-yourself approach that most developers are accustomed to.
Reviews Break Down Knowledge Silos
In addition to learning new skills and techniques, code reviews enable project knowledge sharing between team members. That is, team members can review code that they did not write, ask clarifying questions, and gain a better understanding of how individual sections of the codebase operate. Project knowledge is not siloed to a single team member or group, and this allows for three things:
- If that single team member or group is out of office (for any reason), then the rest of the team is familiar with the codebase, even the sections they did not write themselves. This lowers the level of effort to tackle bugs and new features.
- The single team member or group will have the opportunity to take time off as they are not in a position where they feel like they have to stay in order to meet a deadline or cover an area of knowledge.
- By sharing knowledge about the codebase and complexity of features, the project team can better estimate future work. Instead of one person estimating each task, all team members that participated in a review can also contribute insight, resulting in a better formed estimate.
Additionally, reviews are a great way to share historical knowledge about a codebase. Historical knowledge is all of the tacit knowledge that rarely gets written down, and this information is very beneficial to understand in order to modify code without breaking things. Breaking down the knowledge silos in your project team enables the team to be more collaborative when performing and estimating work as well as have the opportunity for time off.
Code Reviews Encourage Self-Review
Self-review is when a developer looks over their code commits prior to asking for a review. When working with a peer, we can often predict code comments that will be made and this allows us to proactively catch issues in advance. I have to acknowledge the number of times I have pushed code and reviewed it myself because I knew who was going to be reviewing the code and what sort of issues were likely to be raised in a review.
The concept of self-review could also be interpreted as peer pressure as team members get anxious about how others are going to perceive their code. If you know this is going to happen at your organization, keep an eye on it. There is a “my code” mentality that developers often have where we get really connected to the code we write (sorry!), similar to how you would feel when working on a personal project, thesis, research problem, etc. So, when reviewing code, we need to make sure that the conversation focuses on the code, the problems, and the reasoning for the comments rather than on the individual who wrote it. Peer pressure is good in small amounts as it forces us to all be better developers. However, peer pressure to the extreme can be very unhealthy. Check with your team to make sure the code review environment remains healthy and positive.
Consistent Design and Limited Risks
A main benefit of development standards is reduced project complexity and, in parallel, reduced project risk. Code reviews ensure that developers are writing optimized code, implementing security best practices for each framework, and following the team’s agreed-upon conventions for items such as variable and class naming. Reviewers often spot consistency issues where developers implemented functionality in multiple different ways or in multiple different places, and recognizing those situations and resolving them ensures that the project is following a consistent design. Make sure to set up pre-commit hooks and/or pipelines (discussed in the next blog) to automatically run beautifiers and linters as that enables reviewers to spend less time spotting minor issues and more time on design, optimization, and security.
Meet Project Quality Goals and Requirements
This blog series has covered a lot of development standards without specifying how to manage or validate that standards are being followed. Code reviews enable reviewers to validate that code quality requirements are met as they are encouraged to check the code with tools, set up pipelines (explained in the next blog) to run automatic checks, and give feedback on individual changes. Code reviews are a primary way to validate project quality requirements and guarantee that your team is developing a solution that is optimized for performance and maintainability.
Code reviews are essential to ensuring development standards are maintained on projects. They help grow a team’s knowledge and help a team produce high quality work. If you are interested in learning more about development standards and the benefits they can bring to your organization, check out the rest of the blogs in this series.
If you have any questions or want to discuss how your organization can implement development standards into your projects, reach out to us!