Code review is a quality assurance measure for software development. Source code is the fundamental medium of development work and the primary product of programming. Newly created or modified code undergoes a code review. One or more team members review the programmer’s work during this process.
A software project includes a “codebase”. This is a collection of code files which deliver a product. This includes the actual product code, configuration, development tools, tests, and more, all displayed in code. The entire codebase is managed with a version control system such as Git. Multiple “branches” can be used to manage multiple versions of the codebase. This allows new features to develop and progress without changing the production version of the codebase.
Development usually takes place on feature branches, which are periodically integrated into the main branch. Code review is performed before the “merge”, i.e. before new or modified code is merged with the existing codebase. The goal is to detect and eliminate errors at an early stage before the code goes into production.
Weeding out bugs is not the only benefit of code review. The code working, i.e. running without any errors and achieving the desired result, is only a basic requirement. Beyond that, there are a variety of other quality criteria for clean code. The presence of comments, clarity and consistency of code, meeting style guidelines, and integrability into existing systems are all critical and are considered during code review.
Since most development work takes place in groups, thebenefits of code review gobeyond pure code quality. There are social benefits as code review is performed by other members of the development team. New members receive feedback on conventions and best practices, and knowledge is shared and distributed within the organization. Code review helps to cultivate a culture of quality.
The code review processes are usually supported by special code review tools, even if code review is performed by humans. Code review tools aid efficiency and ease the burden of small-scale and time-consuming coordination. This allows the people involved to concentrate on the actual code review.
Conceptually, code review by humans lies between two automated analysis methods, static and dynamic analysis. These are the differences at a glance:
Static analysis | Code Review | Dynamic analysis |
Programmatic | By humans | Programmatic |
Code is read | Code is read, execution is played through mentally | Code is executed |
Consistent style enforced | Integrated into the big picture | Find errors |
Type errors; known vulnerabilities and anti-patterns | Complex security vulnerabilities; code smells | Integration errors; rare edge cases; load tests |