Skip to main content

Code Review

Problem

Code review is a critical process in software development, but many teams struggle with how to effectively conduct it and realize its full benefits.

Context

The goal of this presentation is to highlight critical parts of the process of code review in software development. By understanding the principles, types, and best practices of code review, you will be better equipped to make informed decisions and contribute to the success of your software development projects. This page serves as a reference guide, offering insights and resources to help you navigate the world of code review effectively.

Content

  • Definition of a review: A code review is a peer review of code that helps developers ensure or improve the code quality before they merge and ship it.
  • Business Value: Code review helps in enhancing code quality, finding errors early in the development process, and facilitating knowledge sharing among team members.
  • It costs time: Code reviews take time and resources, which can impact project timelines.
  • Things that can go wrong: Delays, false sense of security, and the complacency paradox are common pitfalls associated with code reviews.
  • Types of review: Code reviews can take various forms, including over-the-shoulder, pull request, and automated tools.
  • Defining expectations: Clear expectations should be set for the code review process.
  • Review checklist: A checklist for code review should cover functionality, readability, performance, error handling, security, and more.
  • Feedback: Constructive feedback is crucial for the code review process.
  • Quick wins: Identify areas where code improvements can be made efficiently in terms of time and effort.
  • Specific Topics: Consider specific code review topics such as naming, separation of concerns, loops, data structures, validation, handling of secrets, and documentation.
  • Use tools: Utilizing code review tools can streamline the process and improve efficiency.

Conflict vs. Reward

Conflict vs. Reward

tip
  • Focus on quick wins.
  • Prioritise high reward / low code conflicts.

Feedback Format

For the author and reviewer, it is warmly suggested to use the https://conventionalcomments.org/ standard to give feedback in pull-request and/or other review formats.

Checklist

1. Functionality

  • The functionality is meeting all the requirements.
  • There are no more missing edge cases.

2. Readability/Maintainability

  • Naming conventions are consistent and descriptive.
  • Functions and classes have reasonable size and complexity.
  • Comments are used to clarify complex and non-obvious code segments.

3. Performance/Efficiency

  • There are no “critical” bottlenecks.
  • The program is using appropriate and efficient algorithms and data structures.

4. Error Handling/Logging

  • Logging for debugging and troubleshooting is implemented.
  • There is feedback on errors and successful operations.

5. Security

  • Inputs are validated and sanitized.
  • Connections to data sources are secured.

6. Documentation

  • The changes have been documented in the relevant parts.
  • The README.md serving as the documentation’s entry point is still correct with respect to your changes.

Resources


info

Code review is not just about finding errors but also about collaborating, learning, and ensuring quality. By adopting the practices and tools outlined here, teams can transform code reviews into a productive and rewarding process.