Code Reviews aren't just about the code
Oct 27, 2023
Code reviews: they're a staple in software development - but why do we do them? Your first thought probably goes towards catching bugs, checking for code quality, spotting inconsistencies with the rest of the project, and making sure your code is doing what it’s supposed to. But, there's a broader dimension often overlooked. These reviews subtly influence team cohesion, knowledge transfer, and can change how we onboard new team members. Let’s unpack the deeper layers of code reviews, and see how they can result in more than just better code.
When we’re up against another deadline, it's easy to view code reviews merely as a gatekeeping exercise. But, there's a subtle, important, aspect to this process: knowledge sharing. When a developer submits their code for review, they're not just seeking approval; they're offering a glimpse into their problem-solving approach. This exchange becomes a learning opportunity, both for the author and the reviewer.
Think about the case where a junior developer employs a certain algorithm to tackle a problem. Through the review process, a more seasoned team member might introduce them to a more efficient or elegant solution. This isn't just about optimizing code — it's about elevating the team's collective skill set. On the flip side, even experienced developers can discover new tricks or alternative perspectives from fresh eyes on their code. Or maybe someone tries out a new library and introduces something to the rest of the team that becomes a mainstay of the codebase.
More broadly, code reviews create a living documentation of decisions made during development. They show why certain solutions were preferred over others, preserving valuable context that's often lost in standalone comments or external documentation (or god forbid Slack conversations). As developers engage in these discussions, they're actively building a shared reservoir of knowledge, ensuring that insights aren't confined to individual minds but spread across the team. However, as a team we have to make sure to bring these decisions out of the reviews themselves, or they run the risk of being lost.
We might sometimes forget it, but software development isn’t a solitary pursuit. Sure, deep work is a vital and enjoyable part of the job, and it's easy to think of it as the most important thing. However, the overall process is inherently collaborative. And code reviews can be one of the most collaborative pieces of the entire development workflow. (If they’re done right - stay tuned for a future article on toxic code reviews)
Think about it - every time a piece of code is up for review, it nudges team members to engage, discuss, and sometimes even debate. It's through these interactions that a shared sense of ownership emerges. No longer is a piece of code seen as the sole territory of its author; it becomes a collective artifact, shaped and refined by multiple perspectives.
And code reviews are a level playing field. Whether it's a new hire just a month into the job or a seasoned developer with years under their belt, everyone's code is up for scrutiny. This process fosters mutual respect and understanding. It emphasizes the idea that everyone, irrespective of their experience, has something valuable to bring to the table. Over time, this can lay the groundwork for trust, and ensure that feedback is received in the spirit of improvement, rather than criticism.
In essence, code reviews do more than just refine code; they refine relationships. They build a framework of collaboration, understanding, and shared purpose, making teams more resilient and cohesive.
How often do you hear stories about companies where one team doesn’t know what another team is doing? Or know the first thing about how the code in a certain part of the project works?
Code reviews act as a powerful antidote to this issue. At their core, they're a communal activity. Every pull request or merge request becomes a window into different parts of the codebase, granting developers insight into areas they might not directly work on. As team members review each other's work, they inadvertently share knowledge about different modules, tools, or techniques.
Think about a scenario where a key team member is unexpectedly unavailable. In teams where knowledge is siloed, their absence could lead to significant disruptions. However, in environments where code reviews are regular and thorough, other members have at least a basic understanding of different parts of the codebase, making it easier to fill gaps and continue momentum.
Another overlooked benefit is the prevention of single points of failure. When only one person knows the intricacies of a critical module, it poses a risk. Code reviews spread this knowledge, ensuring that more eyes understand, and can work on, any part of the project.
In essence, regular and comprehensive code reviews act as knowledge equalizers. They dissolve barriers, ensuring that insights flow freely, and teams remain agile, resilient, and prepared for the dynamic landscape of software development.
Navigating the early days in an engineering team can be like piecing together a giant jigsaw puzzle. For newcomers, there's a two sided challenge: understanding the technical intricacies of the codebase and acclimating to the team's culture and workflows. Code reviews can play a surprisingly pivotal role in smoothing out this onboarding curve.
For starters, joining in on code reviews gives new hires a structured introduction to the codebase. Instead of sifting through thousands of lines of code aimlessly, they can focus on specific pull requests, each giving a snapshot of the larger project. As they review, they not only familiarize themselves with the coding standards and practices but also gain insights into the reasoning behind specific architectural decisions.
But the benefits aren't merely technical. Code reviews are also a gateway to the team's dynamics. Observing interactions in review comments, understanding feedback loops, and witnessing the decision-making process in real-time offers a firsthand glimpse into the team's approach. It's an organic way for newcomers to gauge the team's communication style, hierarchy of authority, and even the unwritten rules that govern team interactions.
Plus, when new team members submit their own code for review, it becomes an opportunity for constructive feedback. Gentle guidance from seasoned team members can help them align faster with best practices and avoid common pitfalls. Such interactions also foster a sense of belonging, reassuring newcomers that they're part of a supportive and collaborative ecosystem.
In a nutshell, code reviews bridge the gap between a new hire’s initial uncertainty and their eventual integration into the team. They provide a blend of technical acclimation and cultural immersion, ensuring that onboarding is not just about learning the ropes, but also about weaving oneself into the team's fabric.
While we've delved deep into the non-technical benefits of code reviews—from fostering knowledge sharing and team cohesion to dismantling information silos and easing onboarding — we also can’t lose sight of their primary purpose. At the heart of it all, code reviews ensure that our software is robust, well-architected, and doing what it’s supposed to do. These two sides of code reviews underscore the fact that code reviews aren’t just a hoop to jump through, but a process that helps both the code and the coders. So, the next time you engage in a code review, remember: it's not just about the code—it's about building better software and even better software teams.
We're building a new way to help speed up code reviews. If you're interested in joining our early Alpha email me at email@example.com