Code reviews: dealing with defensive diff authors

A lot of folks enjoyed and benefited from my post on Giving Better Code Reviews. I received a great follow-up question from AJ that deserved its own post:

I wonder how does one deal with someone in the team who takes a review as something negative? What’s the best way to convey that the review is about quality rather than an individual?

Folks who are just starting out with the code review process typically have a hard time accepting feedback. They usually get defensive — making for an unproductive review. Establishing up-front that “they are not their code” is key.

Coupled with clarity on what the process is trying to achieve (prevent tech debt and bugs, teach, spread best practices, etc), positive reinforcement helps. Make sure to point out positive things in the code review (great tests, clear code, thoughtful modularity) in addition to your suggested improvements.

We all enjoy that feeling when others praise our work. At Bēhance, we often turn to the author and tell them they did a great job on X, or give them a deafeningly loud high-five.

Over time, continue to praise your teammates outside of the review process. They need to feel a few things to overcome their negative perception of code reviews: safe from judgement and blame, that you trust in their abilities (i.e., that you know they’re talented), and that you are their equal in the process (i.e., you don’t have perfect diffs either and want to improve alongside them).