Why do code reviews?
October 15, 2019
I still remember the first time someone left me a comment in a code review. The disrespect, the audacity, how does anyone dare to criticize my perfect code? For me, it was a completely unfamiliar experience to have someone else go through my code and tell me what I should change. Fortunately, after going through the same thing a few times, I accepted and understood the importance of code reviews, and I got used to my new life. First, let’s define: What is a code review? A code review is an activity in which one or more programmers examine another programmer’s code. They do this to find problems of any kind at an early stage of the software development cycle. Right now I can’t imagine a project without code reviews, and the reasons are many. If your team doesn’t code review, I hope these reasons convince you to start.
- No matter how much we want to believe it, we are not perfect. For that reason, having a group of engineers on your team check your code is extremely valuable. No matter how much you look at your own code, there are things you won’t see just because you’re too familiar with it.
- LA code review is an opportunity to learn from the unique backgrounds of your teammates. Even when everyone in your team is an excellent engineer, everyone has different strengths. Some can be very good at unit testing, others will be better at design and architecture, and others at following good coding practices. The point of teamwork is to complement one another’s abilities.
- Even if your code is perfect functionality wise and has no bugs, another crucial aspect is that the code is readable and understandable by other people. Remember that someone else will probably have to change your code, so it’s helpful to know if other developers can “guess” what it does.
- Code reviews are also learning opportunities for other members of your team. It is not only for others to give you recommendations on how to improve your code, but also for everyone to learn to identify problems in code, and to learn from the things you do well.
- Finally, a review helps everyone to become more familiar with the codebase, and keeps everyone aware of the changes made to different repositories day to day. It is also a good way to introduce new members to a project and help them become familiar with the source code.
I hope I have convinced you that code reviews are important, if not essential, to software quality. If your team is not doing them, bring up the idea, or better yet, show them this article! Who knows, you might change their mind.