Code reviews are critical to any project’s success, yet most developers find themselves dreading the review process. More so, GitLab’s recent survey has termed code reviews as the third top contributor to developer burnout, after long work hours and tight deadlines.
Code review, as a process, is a high-ROI activity in creating better code teams, breaking down knowledge silos, and shooting up team collaboration. However, the same process can become highly frustrating, time-consuming, at times demotivating, and even a dent to developer productivity, if conducted haphazardly.
In this article, we'll explore how inefficient code reviews can slow down developers, and how to take the ‘pain’ out of code reviews for engineering teams.
A typical code review cycle involves a reviewer examining a developer's codebase, and providing feedback, improvements, or any alternative approach. Mostly, a reviewer checks for bugs, adherence to coding standards, and general code quality. The loop completes once this feedback is incorporated in the original code base by the commit owner.
The process usually involves multiple rounds of review, with the developer making changes and resubmitting their code for additional review. This iterative process continues until the reviewer is satisfied with the code changes.
Frequent, and structured code reviews are necessary in creating a solid foundation to any team’s software development process. 76% of developers already feel code reviews to be “very valuable” to what they build. Moreover, a strong, and reviewed codebase sets tone for continuous improvement in teams.
While this process is designed to catch errors and improve code quality, it can become a bottleneck in the development process, especially when the review process is not efficient. Inefficient code reviews can block developers from doing productive work, cause long wait times, leading to work frustration, and lower productivity. Let’s see how.
"Developers are sometimes unaware they have to do code reviews. They aren't sure how to perform them and if they are effective. Sometimes they are skipped so the process can go through."
The above code review process might look perfect, but in the real world, it is far from one. Most of the time, code reviews are treated as a secondary process, meaning reviewers can only send their feedback in free time rather than looking to match the pace of the commit owner.
Code reviews are only effective when developers receive feedback within a desired time period. Moreover, devs cannot help but stay blocked, and cannot work again on the same codebase till the reviewer comes with changes. As a result, developers either context switch to another project, or spend their time waiting, thus killing developer’s precious coding hours.
"Finding someone for code review can be hard (1-day average). After that, business tests take time to be completed (2-4 days on average)."
The Gitlab survey also highlighted the after effects of code reviews by a reviewer. A typical review process takes 2-4 business days to complete; by the time, a developer starts working on another task. Now revisiting a 4-day old PR can take a lot of cognitive effort, and context switching from the original owner, leading to reshifted focus, lack of project priorities, and developer frustration.
The issue spirals down further if the team lacks any clear guidelines on how to conduct peer reviews. A lot of times, developers have no idea how to start, and what is expected of them.
“I’m expected to participate, but I’m not quite sure how. I’ll wait until someone else starts.”
When teams cannot find the common ground, or a structured and documented code review process, they end up spending a lot of time in sitting blocked, sometimes even taking 60% of the total development time.
At times, reviewers are at the receiving end of a clogged process. Without enough context, and lack of familiarity with the codebase or technology, assessing the code can become a true nightmare for both sides. It’s simply a Himalayan blunder to expect devs in religiously analyzing a code piece that they haven’t seen before. Moreover, a lack of code description, the journey of the codebase, and lack of purpose of review can make code reviews harder, and super painful, even causing bikeshedding- a common reason behind higher escaped bugs into production, and even reaching the end-customers.
All these practices, if continued, lead to missed deadlines, impacting both productivity and business profitability. The same GitLab survey highlights how 52% of developers felt blocked, and slow due to inefficient reviews, thus, killing their productivity.
52% developers feel blocked, and slow due to inefficient reviews thus killing their productivity.
What’s more is code reviews can become a bottleneck for developers, reducing their morale, and forcing them to look for alternate options. Developers who are dissatisfied with their code review process are 2.6 times more likely to be looking for a new job.
Code reviews is a high RoI activity , only when it is performed in a sustainable way. Here are the best code review practices teams can follow for productive code reviews, so developers can realize their best work.
surveys have already shown how review quality can go down as the size of codebase increases. Devs should limit their code piece to a maximum of 200 LoC. The more readable your code is, higher the quality of code, and better the chances of an effective code review process.
Setting clear guidelines for the code review process can help developers understand expectations and reduce frustration. This includes establishing a code review checklist and enrolling devs to follow it religiously.
A review checklist doesn’t have to be complicated- it can be as simple as using PR templates to populate descriptions or running tests before putting forward your code for final review.
💡Update your existing test so all your review bases are covered, and the reviewer has everything they need to get started.
Moreover, documenting code reviews can make the codebase changes highly traceable, making a huge difference to team cohesion, and individual developer productivity.
32% of developers feel their code review process improved significantly after adding automation into their workflow. Automating code formatting and linting, can help reduce the time and effort required for manual review. Use static analysis tools for faster feedback, and a strengthened codebase.
Fostering a positive culture around code reviews can help reduce burnout and improve morale. This includes encouraging constructive feedback and recognizing and rewarding good review practices. Automation is one way to do so; the other way is to reserve specific hours for code reviews. 45% of developers review their code weekly, while 22% do reviews once every two weeks.
💡Stop switching context when reviewing code. Peer review requires special focus and cannot be performed, if devs keep juggling between multiple tasks, all at once.
Engineering analytics platforms help teams improve their code review process by boosting end to end visibility. With Hatica's review collaboration dashboard, developers can easily collaborate on code reviews, track review progress, and identify areas for improvement.
By analyzing code metrics and team’s work trends, Hatica can help identify bottlenecks in a team’s review process: did the reviewer pick up the codebase within time? If not, why? Is the reviewer overburdened with other project work, or sprint issues?
Hatica collates all team-related data at one place so teams know where exactly they are stuck, and how to achieve a better review flow for the team.
Code reviews can be a double-edged sword- they are an essential part of producing high-quality code and catching errors before bugs become costly product mistakes. When done without context, and efficiency, they can be a source of frustration and even burnout for developers.
The key to successful code reviews lies in adopting best practices like setting clear objectives and guidelines, adopting automation tools, and fostering a positive culture.
By doing so, teams can ensure that code reviews are productive, efficient, and even enjoyable.
Subscribe to the Hatica blog today to read more about unblocking developers, and boosting productivity with engineering analytics.