Aren’t code reviews great? Its the most democratic event of a team. You can share your concerns about a piece of code or share knowledge.
Equally important is that code reviews minimize the risk of deploying bad code to production. Also, its the process that allows us to make mistakes while writing code and feel safe that someone else may note our mistakes.
Isn’t that GREAT? Its a god damn festival of transparency.
But, I’m sure you can see it. As long as there is social interaction, we can make code reviews SUCK.
What can go wrong with code reviews?
If you haven’t polished your social skills recently, code reviews can lose their worth and, even worse, make things tense.
Bad code reviews can demotivate people and kill their productivity. People can feel they are not trusted, get stressed out, stop taking initiatives and lose their self-esteem.
They may even be afraid of feedback, and if feedback is almost always negative and the team is never satisfied, people may even stop trying.
The deadly sins
Disrespect the subject of discussion
The subject of discussion is the code written by a developer or a team of developers. Its the result of their effort, so we have to treat it with respect.
Objections have to be technically justified, so bad or minor objections will remain out of discussion. These types of objections will just get deliverables late and slow down the development process.
We can decline objections but, again, only when we can sufficiently justify why they have to be declined. Otherwise, not accepting objections will turn code reviews useless.
Simple rules of thumb
Tolerate the diversity. Nobody can write code the same way you would. Every team member can implement a totally different solution to a single problem and that should be OK.
Trust your fellow developers.
Changes asked have to offer added value to the project. Strictly limit yourself to those cases:
- the code introduces risk to production
- the logic is incorrect,
- the performance is poor,
- the code is inefficient / has code smells (violates fundamental design principles that impact the design quality)
- the code doesn’t respect coding standards
You break code reviews, you lose.