Why Code Reviews?

Why Code Reviews?

Creating high-quality software is not an easy thing to do. It takes a lot and obviously starts with talented people. But even with the most talented crew, it requires a lot of effort and orchestration to achieve great quality.?

Luckily we stand on the shoulders of giants who taught us the pillars of great software. One of those pillars is a code review, and below I would like to address why you should have a code review in place and why a code review is much more than just early bug prevention.

Brainstorming

How often do you have time to get together with one or two teammates and bounce ideas off each other, while working on a complicated problem? Once every two weeks? Maybe more than that? With the industry, which takes advantage of having distributed teams, and having people working in different locations and at different timezones, it is not always easy to “get together” and do some brainstorming.?

Code reviews provide an opportunity to engage in a discussion, and to leverage the knowledge of your teammates. It can often provide better results than your average whiteboard brainstorming as code review assumes that there is already some work done, thus the team has a lot more substantive conversation.

Learning

Whether you are a new team member, mentoring or being mentored, or just stumbling on a part of your software that you are not aware of, code review is one of the most efficient ways of learning.?

I have to admit that I learned a great deal of programming while receiving advice from my teammates when my code was being reviewed. To this day when there is an opportunity to write or review a code the advice that I heard from my teammates years ago is still ringing in my ears.

Vacations

Yes, vacations! Nobody wants to have their vacation delayed, because they are working on a critical feature that only they are aware of. Having code reviews allows for spreading knowledge around the team. Even if there is a particular area of the code that you personally haven’t written, you still will find yourself having gained a lot of knowledge about it by reviewing the code of the person who wrote it.?So, when it’s time to step into that area of the code you find, it is a lot less stressful and much easier to work on.

Quality

Whether it is preventing bugs, making sure the requirements are met, or solving performance and security issues, the second pair of eyes is a great idea.?

We do tend to get blindfolded or develop blindspots while focusing on a problem, so having your teammate observe the problem from a different angle can help avoid those pitfalls.

Consistency

Even though we employ tools like ESLint to ensure consistent code styling, we still need to put an effort into achieving consistency of the code as it goes far beyond just consistent styling. True consistency is making sure we apply consistent approaches while solving similar problems, making sure that we re-use the code rather than create duplicates here and there, and so on.?

Having your teammates point out where there are similar solutions applied in the code is very helpful and can be a great timesaver.

Cost-efficiency

Last but not least, code reviews are helping a lot with cost savings by reducing maintenance time. Studies are showing that code inspection is up to 20 times more efficient than testing and that every hour spent on inspections avoided an average of 33 hours of maintenance .


Having said all this I would like to mention that starting with the code reviews would not instantly bring you all of the benefits listed above, as any process code review should be implemented properly and constantly improved. In my next article, I would like to take the opportunity of telling you about the “how” of the code review process rather than the “why”.

要查看或添加评论,请登录

Tigran Sargsyan的更多文章

  • Code Reviews: The How

    Code Reviews: The How

    In my previous article Why Code Reviews?, I addressed the necessity of employing code reviews in the software…

    3 条评论

社区洞察

其他会员也浏览了