woman coding on computer

Tips for Code Reviews

We in 42mate, on every merge request, we do (or at least we try) to do code reviews.

What is a code review? In my words, Is a process were a developer send their code changes to other developers. The developers send comments to improve the code quality.

How do we do it, since we use Gitlab, and we follow the git flow to work, on every merge request, the merge request can be shared and comments can be placed on each line of code. The developer see the comments and can reply or improve the code using the comments that other developers share.

The main objective of this process is to improve the code quality, however, there are other goodness in the process, like to share knowledge, see what others are doing, learn and more.

Since put comments on other peoples code is hard and somethings can hurt feelings, we need to be very delicate on what and how to comment. Besides that, this process is a real blocker for the daily developer work, since it has to wait for some reviewer to check their code before merge and push the code to some environment to be tested. If other developers are busy, it can be a long wait.

Here are some tips to improve the process

  • Check your changes before push, send only the important, do not push unnecessary changes.
  • Be your first reviewer, don’t wait other to review, you most do the first review. The fix the issues that you see and once it’s check and fixed, then share the code to others to review. That will save your and your team mates time.
  • Value others team mates time, as soon you see a request for code review, make time to check it.
  • Never take personal the comments, people are bad writing, do not take literally what they say, focus in the suggestion.
  • Do not use “you”, you are not reviewing the developer, you are reviewing the code. Talk about the code, not about the developer.
  • On an issue, besides the comment on what is wrong, suggest a solution.
  • Provide examples
  • Provide links to documentation of your suggestion if applies.
  • If something is good, send a cheer. You can share positive reinforcement.
  • If the reviewer is not understanding your comments, make a call and work together.
  • If you as reviewer are not understanding the comments, ask for a call, and work together.
  • If nobody is reviewing your code, keep asking for review.
  • If nobody has reviewed your code after an hour, and you are not sending something critical, go ahead and merge. However if you have something critical in the MR, keep asking for review.
  • You don’t need the entire team to review your code.
  • Get involved in the reviewing process, it does not matter if you are junior o trainee. Keep involved, make reviews, put comments, make questions, learn from others.
  • Everybody make mistakes, even the more seniors, they probably will do more mistakes than juniors, so review seniors code with confidence.

I hope this comments can help into your process.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.