What to focus on in code reviews

There are several key aspects to consider during a code review. First and foremost, the code should effectively solve one specific thing. Whether it’s a diff or a file, it should have a clear and singular purpose. The diff description and the modified file should both represent one cohesive concept. Additionally, when examining the methods being maintained, they should also have a singular purpose. Ideally, the design intent should be evident and well-respected.

The second important aspect to focus on is naming. Good naming conventions are crucial. Terminology acts as a bridge for human understanding. If you introduce a term that can be interpreted in multiple ways, or worse, one that is misleading, it can cause confusion when others read and follow your code. A meaningful name conveys multiple threads of meaning. For instance, if you are retrieving details for an accountant in your system, it’s preferable to name your method ‘getAccountantById’ rather than ‘getUserById.’ The chosen name should align with the purpose of the code and make it clear that you are trying to retrieve an accountant, a name who is responsible for the financial aspects. Of course, this assumes that you are building some kind of ERP or system that will be used by accountants.

The last crucial aspect to consider is duplication. If you find yourself having to read code multiple times or come across copied and pasted code, it’s often indicative of incomplete articulation. If you encounter similar code in different places, such as three methods all hitting the database to fetch something, it might be worth considering whether this could be combined or if there’s a more appropriate technology to use, like GraphQL, which enables more articulate information exposure. It’s possible that the code lacks the right level of abstraction. Whenever you notice repetition, it’s likely that there is something fundamentally wrong with your code’s structure and thinking. Addressing these issues is essential.

So those are my thoughts on what to look for in a code review. This list is not comprehensive, but it highlights important aspects to consider. What are your own thoughts

Talk to me on my Twitter @jchex


Published by


Software Project Manager