As they say, two heads are better than one. In coding, two (or more) other sets of eyes are better than one, not only for the purpose of appreciation and confirmation but also to be able to fine-tune what you've already accomplished. After all, much like writing a story, you still need someone to proofread it because after a while you would probably not really see the mistakes anymore. And according to many programmers, reading code is harder than writing it, so some assistance from peers should always be welcome... and that is one of the main purposes of code reviews.
As the term suggests, Code review is the process of checking the quality of a source code mainly by reading it. Ideally, another coder or programmer (or several), preferably a more experienced expert, checks the code for bugs and logic errors, makes sure it meets project requirements, and also if it complies with industry standards, internal conventions, and best practices. This is why it can also be called a Peer Code review.
"Code review is important to make sure that the proper coding guidelines are followed to prevent technical debt. Oftentimes, code reviews provide outside perspective to the developer that will make their code better and life easier."
~ Joey, NodeJS developer
Code review is a crucial part of the software development process because…
Performing code reviews lets developers see and check each other's codes, making them aware of what the other is working on and how they're writing it. Not only does this lend fresh sets of eyes on the code, but it also helps teammates know what to avoid and helps them be consistent with conventions across the project. This makes the team more agile and flexible as no single person would be a crucial member that could be a possible bottleneck in the development process.
Code review also enables workload sharing. As team members get to know each other's work, everyone can become a point of contact for a piece of code. No one is a lone wolf when it comes to coding. So when one developer gets sick or suddenly becomes unavailable in an emergency, for instance, another team member can easily take over the work and the production doesn't have to stop. In short, it helps ensure the continuity of the software development process.
As the saying goes, prevention is better than cure, and that likewise applies to coding. Fixing bugs or errors after all the major work is done rather than during development is more difficult to trace and fix, requiring more hours to accomplish. Meanwhile, reviewing code lets you discover bugs early, thus improving code quality as you go, which, in turn, saves time and money overall.
"Code review is an excellent avenue for learning and knowledge sharing. It's a great opportunity for junior and senior developers to work together. It helps the junior developers grow their skills quicker since they can participate in it, and they can receive immediate feedback from the senior dev for every code change."
~ Gayle, Angular developer
Whether it's for a junior developer or simply a new team member, code review can help impart to them essential general knowledge such as coding standards and industry best practices. For instance, it can help you pass on techniques on how to quickly and properly track bugs as well as drill the importance of commenting code for future developers who may take over the project, or even just for their "future" selves.
Team members reviewing each other's code can also ensure the implementation of a consistent coding style, making it more readable and maintainable in the long run. So when new members join or members get replaced, it would be easier for them to adjust and insert themselves into the project. New members won't be confused about which style to follow, and the team can focus more on innovating the application instead of figuring out how modules work together (or not).
Here at Arcanys, we perform code reviews for the simple reasons that it makes us better coders and helps us turn in quality outcomes/output. And how do we do this exactly? By following the coding standards and principles, which I've discussed in detail in another article — 8 Golden Principles when writing code. So check that out.
Software Architect
Software Architect
Eric has been working as a software engineer for more than 20 years. As a senior architect for Arcanys, he works closely with the developers to instill the habit of learning, clean coding, re-usability and testing with the goal of increasing the overall quality of the products delivered by the teams.