At Agathon, code reviews are a critical step in the lifecycle of a new feature or bug fix. These reviews occur once the primary developer considers the work completed but before the update has been launched.
What is a code review? A code review is simply when one or more developers review the code another developer has been working on. The goal for reviewers is twofold: to be familiar with all of the code and to provide feedback that improves the code.
While code reviews take time and development hours, they are a critical part of the process for knowledge sharing, quality assurance, and future proofing the project.
For knowledge sharing
There is a natural tendency for developers to specialize in certain aspects of a project. While this is expected and okay in moderation, developers shouldn’t get too siloed into “their” areas. When developers are only able to work on particular portions of a project, it impacts schedule flexibility and responsiveness to project changes. In a perfect world, every developer on a project should be able to contribute to any area as needed.
Code reviews spread project knowledge among all of the developers involved. Reviewing the code another developer has written provides familiarity with that area of the code. This makes the entire team more adaptable to the demands of the project.
Additionally, code reviews provide a great venue for developers to share details about why they made particular implementation decisions. If there’s something a reviewer doesn’t entirely understand or would have done differently, that discussion is helpful for both parties. This provides a learning opportunity for both the reviewer and reviewee.
For quality assurance
We only hire human developers here at Agathon (sorry Marvin!). Unfortunately, even the best developers can sometimes make mistakes. Having another developer review the code is a way to identify mistakes before they’re published for the world to see. Reviewers don’t just review the code as written; they also think through tricky edge cases and ensure the code handles those properly.
A second perspective is also very helpful in uncovering better solutions. Developers immersed in a problem can have a hard time stepping back to review the code with fresh eyes. However, the reviewer doesn’t have this baggage. Getting a different perspective often yields suggestions for a better solution, which better serves the project.
For future proofing
Code reviews also improve the efficiency of future work. By reviewing someone else’s code, the reviewer has fuller knowledge of what solutions have been used throughout the project. If a similar problem comes up later, they’re more likely to look for ways to reuse the solution rather than starting from scratch.
In addition, code reviews ensure that the new code follows the standards and conventions used throughout the project. While each person may have a different development style, these standards make it easier for others to jump in and understand the code. If the reviewer is having trouble making sense of the changes, that’s a sign the code in question might need to be revisited.
How code reviews work at Agathon
The life cycle for new features often includes a few different phases. The “review” phase allows the product owner to see the new feature in action in a test environment. Behind the scenes, we also use this review phase for code reviews.
The primary developer will trigger or request a code review at this stage of the workflow. New features are developed within a branch on GitHub. This branch includes the current live code plus the work for the new feature. Code reviews happen on GitHub, which provides a handy interface for developers to see and discuss the changes in this branch.
Once a review is requested, reviewers aim to review and provide feedback within a day or two. This ensures the review doesn’t hold up the launch of the new feature. The developers then talk through the review and incorporate changes before the updates are deployed.
While often unseen by the product owners, code reviews are a critical part of the development process. Reviews also help developers expand their skills by seeing what other people are doing and being able to talk through the reasoning behind those decisions. That results in better work on both current and future projects!
Are you a developer? Do you participate in code reviews?
We’d love to hear how your team does code reviews! What other benefits have you seen from this part of the development process?
- Code reviews: a critical part of the development process - May 7, 2019