What’s the end goal of the code review?

To make sure that changes work? To validate if code is following the style guide? To check if new changes won’t break anything? All of these? None of these?

All of these questions are necessary parts of the code review, but none of them are its ultimate goal.

The primary purpose of the code review is to make sure the solution is solving the problem in the best possible way — from both the code and product perspective.

All code-review practices are designed to meet this end goal.

But how do you determine if the solution you’re reviewing is the best way to solve the problem? In other words, how do you code review?

Let’s deep dive into it.

There’s No Perfect Code

Before you start reviewing code, you need to understand that there’s no such thing as _perfect _code — there’s only balanced code.

You, as a reviewer, should balance out the need to make forward progress with understanding the importance of the changes.

Stop seeking perfection.

You don’t just write code for code — you solve a business problem with the code.

If code solves a problem and improves the maintainability, readability, and understandability of the system, even if it’s not perfect, don’t delay it for weeks. Leave a comment on how the author of the changes can improve their code, and give it a green light.

Your Opinions Aren’t Authority

Everyone has their own personal opinion on everything: how you should write code, how many hours you should spend on it, why you need to use some text editor and not another, and many others.

We all have different experiences and different backgrounds, but we need to turn them off during the code review.

When you’re deciding if the solution you’re reviewing is written well or not, you have to rely on technical facts and standards, not personal preference.

For example, while coding, maybe you always use a semicolon at the end of the line, but the author of the code you’re reviewing doesn’t. The first thing you want to do is leave a comment like “Add semicolon here.” But what you should do instead is create a style guide and make it a standard in the team.

The code base must be consistent and not written to conform to personal preferences.

#code-review #programming #startup #software-development #software-engineering

The Complete Guide on How to Code Review
1.05 GEEK