version v7.2.
For up-to-date documentation, see the
latest version.
Code Review
4 minute read
Objective & Benefits
Code review is a systematic examination of source code intended to find and fix mistakes overlooked in the initial development phase, improving the overall quality of software.
Key benefits include:
- Improved code quality: Catches bugs early in the development cycle
- Knowledge sharing: Facilitates learning and cross-pollination of ideas within the team
- Consistency: Ensures adherence to coding standards and best practices
- Collective ownership: Increases shared understanding of the codebase
- Mentorship: Provides opportunities for junior developers to learn from seniors
Practice Description
Code review is a systematic process where one or more developers examine another developer’s code changes before these changes are integrated into the main codebase. The primary goal is to ensure code quality, catch potential issues early, and share knowledge within the team.
Core Principle
At its essence, code review involves a reviewer (or multiple reviewers) carefully examining the changes made by another developer.
This review process focuses on several key aspects:
- Functionality: Ensuring the code correctly implements the intended features or fixes.
- Code Quality: Checking for clean, readable, and maintainable code.
- Architecture: Verifying that the code aligns with the project’s overall design and best practices.
- Performance: Identifying potential performance issues or inefficiencies.
- Security: Spotting potential security vulnerabilities.
- Consistency: Ensuring adherence to the team’s coding standards and conventions.
- Documentation: Checking that the code is adequately documented where necessary.
Common Forms of Code Review
Pull Request / Merge Request Reviews:
- Most common in modern development workflows
- A developer submits changes as a pull/merge request
- One or more team members review the changes before they are merged into the main branch
- Typically integrated with version control systems like Git
Pair Programming:
- Two developers work together in real-time
- One writes code while the other reviews and provides immediate feedback
- Roles are often switched regularly
Group Reviews:
- Multiple team members review the code together
- Ideal for complex changes or critical parts of the system
- Promotes broader discussion and diverse perspectives

By following this practice, teams can significantly improve code quality, reduce bugs, and foster a collaborative development environment.
Common Pitfalls
Nitpicking
- Challenge: Focusing too much on minor stylistic issues.
- Solution: Implement automated code formatting tools and style checkers. Reserve human review for more substantial concerns like logic, architecture, and maintainability.
Delayed Reviews
- Challenge: Causing bottlenecks in development due to slow review processes.
- Solution: Set clear expectations for review turnaround times. Implement a “review buddy” system to ensure timely reviews. Consider using tools that notify reviewers of pending reviews.
Inconsistent Standards
- Challenge: Applying different standards to different team members.
- Solution: Develop and document clear coding standards. Use checklists for reviews to ensure consistency. Regularly discuss and refine standards as a team.
Lack of Context
- Challenge: Reviewing code without understanding its purpose or the bigger picture.
- Solution: Require developers to provide context with their code submissions. This could include linking to relevant tickets, explaining the problem being solved, or providing brief documentation.
Ego Conflicts
- Challenge: Allowing personal preferences to overshadow objective improvements.
- Solution: Foster a culture of constructive criticism. Encourage reviewers to explain the reasoning behind their suggestions. Train team members in giving and receiving feedback effectively.
Incomplete Reviews
- Challenge: Rushing through reviews without thorough examination.
- Solution: Break down large reviews into smaller, manageable chunks. Use review checklists to ensure all aspects are covered. Allocate dedicated time for code reviews in sprint planning.
Ignoring Non-Functional Requirements
- Challenge: Focusing solely on functionality, neglecting aspects like security or scalability.
- Solution: Include non-functional requirements in review checklists. Involve specialists (e.g., security experts) in reviews of critical components. Conduct regular training on non-functional aspects of software development.
Overreliance on Individuals
- Challenge: Depending too heavily on specific team members for reviews.
- Solution: Implement a rotation system for reviewers. Encourage knowledge sharing sessions to broaden expertise across the team. Use pair programming to spread knowledge more organically.
Remember, addressing these challenges requires ongoing effort and communication within the team. Regularly reviewing and adjusting your code review process can help in overcoming these common pitfalls and improving the overall effectiveness of code reviews.