DEV Community


Posted on

Why do code reviews?

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 new experience to have someone else go through my code and tell me in detail what I should change. Fortunately, after going through the same thing a few times, I began to accept and understand the importance of code reviews, and I got used to my new life.

First of all, 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. This is done in order to find problems of any kind at an early stage of the software development cycle.

Right now I can't imagine a project where code reviews are not performed, and the reasons are many. If your team doesn’t do code reviews, I hope these convince you to start.

  1. No matter how much we want to believe it sometimes, 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.

  2. A code review is an opportunity to learn from the different 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.

  3. 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 your code will most likely be modified by someone else in the future, so it's helpful to know if other developers can "guess" what it does.

  4. 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 of course, to learn from the things you do well.

  5. Finally, a review helps everyone to become more familiar with the codebase, and keeps everyone aware of the changes that are 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.

Top comments (0)