If you are reading this post, you must already be familiar with code review. Big software development companies adopted this practice years ago and even created their own tools for code inspections. Smaller ones with more limited resources and budgets also try to allocate some time and money to reviewing their code. We at Letzgro engage experts in various technologies for CR if we don’t have available programmers. Yet many people argue that it is time-consuming and often proves ineffective. As ardent proponents of code review, we would like to dispel your doubts by presenting the benefits we obtained by regularly reviewing our code.
Triggers for code review
[announce]
The most obvious advantages are gained by developers, but we believe that no one gets more from code review than the clients who get a neat code. An insightful study into Expectations, Outcomes, and Challenges Of Modern Code Review which was conducted by Microsoft reinforces all the pros by qualitative and quantitative data. Here are the primary motivations for doing code review according to the research:
- finding defects;
- code improvement;
- increased team awareness;
- knowledge transfer;
- creation of alternative solutions to problems.
Developers’ Primary Motivations for Code Review
Naturally finding defects is the primary reason for doing code review, as it eventually turns out to be a cheaper form of eliminating bugs when compared to testing. The desire of developers to improve the code results in a higher standard of software and ensures better maintainability, readability and consistency of the source code. Yet another indisputable advantage is the creation of alternative solutions to the problems you face during the development process as collaborative thinking increases the chances of coming up with a more elegant hack to write high-quality code.
More benefits for developers
Some of the other benefits of CR for developers include:
- maintaining coding standards across the company;
- software security;
- eliminating errors in software design;
- shared code ownership across the team gives you the ability to take a day off without risking the success of the project;
- teaching and on-boarding new team-members;
- a new person in the team can give a fresh look at the problem;
- understanding of the workflow and code improvements by everyone in the team;
- good for the Agile approach where all the members are relatively equal.
Why code review is good for your business
The aforementioned points are, of course, tightly intertwined with the assets code review accumulates for businesses that acquire the code such as:
- saving money by stopping bugs early;
- spending less time and money on testing;
- more accurate estimation of work;
- getting a secure code;
- getting a readable code which you can take to any other company for further development;
- you are not dependant on one person, no one is critical to some important part of code because everyone in the team is involved and has an understanding of the changes and improvements;
- building the trust of investors and stakeholders in the final product.
Testing vs Code Review
According to research done by Steve McConnell in his work ‘Code Complete’, code reviews are much more efficient than any kind of testing in eliminating bugs.
Tool-based vs peer code review
Peer code review, which is usually performed as a line-by-line manual examination of code by fellow developers, often proves to be time-consuming. So nowadays coders combine it with tool-based code reviews. Using a typical CR tool users can:
- comment on the source code;
- communicate with peer developers in a live chat;
- select people for code review;
- receive notifications about the task;
- get textual explanations of a change or code improvement.
Google has Mondrian, Facebook uses its Phabricator and Microsoft employs CodeFlow for tool-based code inspections. There’s also quite popular open-source Gerrit tool, and our mobile developers recommend OC Lint when working with C, C++ and Objective C. Actually, the review of various tools for performing code reviews of different technologies is worth a separate post. So, if you wish to find out more about the pros and cons of such tools, feel free to leave your comments and we’ll be happy to compile an article covering them.
There are certainly more benefits of code review not mentioned in this post (and you are welcome to add them in your comments), as well as the challenges that might still be keeping you from adopting regular code inspections. Yet we hope this post will encourage more people to join our code review fan club 🙂 so that you could also reap tangible benefits from code review right now!