The Traits Of A Good Code Review

The Traits Of A Good Code Review

Aug 15, 2021·

2 min read

Play this article

I've recently started a new software engineering role and performed my first code review a few days ago.

If you don't know what a code review is, it's an activity carried out by software engineers, and it consists of checking someone else's code and looking out for any mistake.

When performing this activity, there are some aspects that you might want to consider to ensure that the code review is conducted successfully for you and your team members.

Here is a comprehensive list of questions that you might want to ask yourself when performing a code review:

  • Is the code efficient both in terms of runtime and memory? Is the code secure? Code efficiency is essential because we want the code to be highly performant and reliable. For example, you might want to look for redundant code and ensure that errors and exceptions are handled consistently throughout the code.

  • Is the input validated correctly? Certain parameters can only accept specific inputs. For example, can we take negative values?

  • Is there any more straightforward solution to the problem? It is a great software engineering practice to keep the code as simple as possible. You can look for multiple if statements, over-complicated patterns, complex loops, etc. Take any chance to make the code understandable and straightforward.

  • Is the code readable and well-formatted? Code should be written so whoever comes later can easily understand what is happening. Check if variables are named appropriately and eliminate unnecessary spaces and tabs. Look at the pull request, and ensure that the code is always left cleaner than before. See if you can use better programming concepts to improve the quality of the code. Even the slightest improvement can make a massive difference.

A code review is a collaborative task that benefits you and your team. Try to make it as constructive and pragmatic as possible. Give feedback to encourage improvement and explain why specific changes can benefit the code.

I hope you've found this helpful!

Did you find this article valuable?

Support Maddy by becoming a sponsor. Any amount is appreciated!