Close

2022-06-10

Things you should look for in a Code Review

Things you should look for in a Code Review

Code review, or peer review, is a quality assurance activity in software development where one or several individuals examine parts of the code. The purpose of code review is to ensure that the code base is of good quality and to allow reviewers and authors to learn from each other.

When conducting a code review, it is essential to first look at the code’s functionality. Reviewers can check for edge cases, potential problems, and apparent bugs by reviewing the code. Valuing the changes by trying the feature or running a demo to check for performance issues or bugs is also helpful.

Another important aspect of code review is assessing the code’s complexity. If a function or component is too complex to understand quickly, there is a risk of potential bugs and complex debugging. This is known as over-engineering when code has unnecessary elements that do not immediately serve the system’s needs. Instead, engineers should focus on the current needs of the system, not potential problems for the future.

Naming variables, functions, and classes are also crucial in code review. Good names should effectively communicate what the code does or is without being too long or hard to read.

Comments are often considered flawed in code reviews. If the code is unclear enough to explain itself, it should be made simpler rather than relying on words. However, there are exceptions, such as in regular expressions and complex algorithms, where comments can help explain the purpose of the code. In general, words should be clear, without errors, and only used for information that cannot be contained in the code, such as the reasoning behind a decision.

Styling is another crucial aspect of code review. Reviewers should ensure that the changes follow the appropriate style guides for the language used. This includes adhering to coding conventions and recommended programming styles and practices.

Tests are also essential to code review, especially for changes that are not hotfixes. Reviewers should ask for the unit, integration, or end-to-end tests and ensure they are helpful, clear, and correct. It is important to remember that tests are code and should be reviewed like any other code.

Finally, if the code looks good, reviewers should compliment the author. This can provide positive encouragement and motivation for developers to continue producing high-quality code.

The article is “Things you should look for in a Code Review.