Code reviews

Greg Foster
Greg Foster
Graphite software engineer

Code reviews are an integral part of the software development process, serving as a checkpoint to ensure quality, consistency, and collaborative knowledge sharing within a development team. This guide aims to provide an extensive introduction to the principles and practices of effective code reviews, integrating knowledge from industry studies, best practices from top tech companies, and insights into the use of modern tools like Graphite, which builds upon the foundation of platforms such as GitHub.

Code reviews are an integral part of the software development process, serving as a checkpoint to ensure quality, consistency, and collaborative knowledge sharing within a development team.

A code review is a stage in the software development workflow where the source code changes made by a developer are examined by one or more peers before the code is merged into the main codebase. The primary objectives are to:

  1. Ensure Quality: Detect and fix defects early in the development cycle, reducing the cost of bug fixes and ensuring high-quality output.

  2. Maintain Consistency: Align the new code with existing design patterns and coding standards to maintain a coherent codebase.

  3. Share Knowledge: Facilitate knowledge transfer among team members, promoting a deeper understanding of the codebase and development practices.

  4. Improve Skills: Provide an opportunity for developers to receive constructive feedback on their coding practices, leading to skill enhancement.

The benefits of code reviews are well-documented, with studies showing a significant reduction in defect density and improvements in code quality. For instance, a SmartBear study of a Cisco Systems programming team suggests that reviewing fewer than 400 lines of code (LOC) at a time leads to a higher defect discovery rate, with optimal inspection rates under 500 LOC per hour.

While code reviews involve scrutinizing code after it has been written, pair programming is a real-time collaboration where two developers write code together. Both practices aim to improve code quality and facilitate learning but differ in their execution and focus.


Before diving into code reviews, it's essential to:

  • Establish clear coding standards and guidelines.

  • Ensure reviewers have a comprehensive understanding of the codebase and the functionality being implemented or altered.

  • Utilize tools that enhance the code review process. For example, Graphite's pattern of stacked code changes allows for more organized and manageable code reviews on top of platforms like GitHub.

A typical code review process involves several stages:

  1. Selection of Reviewers: The code author selects relevant reviewers, considering expertise and domain knowledge.

  2. Code Examination: Reviewers inspect the code for defects, readability, and maintainability, often using checklists as a guide.

  3. Feedback: Comments and suggestions are provided to the author, who then works on integrating the feedback.

  4. Approval and Merge: Once all parties are satisfied, the code is approved for merging into the main codebase.

The effectiveness of code reviews is heightened by following best practices, such as:

  1. Reviewing Small Increments: Smaller, more frequent reviews are more effective than large, infrequent ones.

  2. Providing Constructive Feedback: Comments should be specific, actionable, and focused on the code rather than the coder.

  3. Emphasizing a Learning Culture: Reviews should be seen as opportunities for growth, not just error detection.

Code reviews are more than just a quality check; they are a cultural practice that, when implemented effectively, contribute significantly to the health of the codebase and the development team. By adhering to the practices and principles laid out in this guide, teams can leverage code reviews as a powerful tool for continuous improvement and learning.

Stay unblocked. Ship faster.
Experience the new developer workflow - create, review, and merge code continuously. Get started with one command.
Get started

Give your PR workflow
an upgrade today

Stack easier | Ship smaller | Review quicker

Or install our CLI.
Product Screenshot 1
Product Screenshot 2