Code reviews - Are you checking for this?
Published 2/2/2022
What do you look for when you review your peer's code? Is it that the new code is consistent with the existing codebase? Do you check for typos? Existence of tests? Correct formatting? Documentation? That the code logic is correct and easy to grasp?
While some of the above can be automated, these may all be important things to check in your daily code reviews.
And while developers love their code patterns and clean code, there is one aspect in code reviews that should be prioritized: The business requirements.
Take this piece of code for example:
const title = article.title
return containsProhibitedWord(title)
Yes, suggesting that the variable "article.title" can be inlined is a good idea. But don’t let that distract you too much, as changing the syntax doesn’t fix the fact that the article body also needs to be checked.
That’s why it is important to not only review syntax and architecture, but also the actual implementation of the requirement.
Note that sometimes, it's after a refactor that you realize the inconsistency with the business requirements because the code is now easier to understand and follow.
This was an excerpt from my e-book Intent-Driven Development which will teach you how to simplify the day-to-day code you run into and the balance between over- and under-engineering. Get it over at https://michaelzanggl.com/intent.