How to handle criticism during code reviews

Handling criticism during code reviews can be difficult
Handling criticism during Code Reviews
Photo by jean wimmerlin on Unsplash

How we can tolerate, and handle criticism during code reviews will depend on many factors, for example, the tone of the feedback, or what the feedback is about. But, surely many of us have already received feedback that was well-intended and well written, and still, it felt like a punch in the face.

Indeed, being open and actively listening to feedback, especially when it is contradicting our own beliefs is hard.

Our lizard brain makes handling criticism during code review hard

One reason for this is a minor part of the brain called the amygdala. The amygdala handles our flight or fight (and also freeze) reactions and is triggered each time we face a threat.

This part of our primitive brain structure was essential and crucial when we were confronted with large and dangerous animals – back in the day. You probably can’t remember 😉

Still, studies have shown during MRI scans that the same areas of the brain get activated when we are confronted with statements that are contradicting our current beliefs.

So, during a code review, it is just natural that our amygdala reacts when we hear contradicting suggestions, and we feel criticized for our code.

How do deal with code review feedback that challenges our beliefs?

You probably experienced it yourself: if you get a request for a change in the code for something that you are neutral about (or even agree with), it is easy for you to control your emotions and to take the feedback. This kind of code review feedback feels nice, friendly and collaborative.

On the other hand, if you get a request to change code in the pull request you are sure is correct, your immediate reaction will be to be infuriated. You might feel challenged by the code reviewer. You might instantly think about arguments to fight for your way in this pull request. Well, you just found yourself in a conflict situation. And conflicts during code reviews are one of the main code review pitfalls.

We find ourselves in the middle of a code review conflict

Well, as an engineer, your answer might be, of course, we just find out who is right and who is wrong. Then, the correct solution wins.

Unfortunately, life is not white and black, and not only made out of zeros and ones. Life and code reviews are more nuanced than that.

Often, there is no right or wrong solution. Often it is about tradeoffs and compromises during code reviews.

But, more importantly, each conflict is always about relationships. And the impact of the conflict on the relationship is at least as important as the solution itself, if not more.

How can we handle and resolve conflicts during code reviews?

Well, it all starts that we have to get over the flight or fight reaction. The good thing about code reviews is that they are often asynchronous. So, you can just wait for a little to let your brain calm down. Once your amygdala stops firing, you have more access to your rational brain.

Second, it’s important to realize and acknowledge that you might experience something called the backfire effect. Researchers that investigated the neural systems involved in maintaining beliefs in the face of counterevidence studied and observed this effect.

What the researchers found is that when people hear contradicting evidence to their current worldview, this contradicting information enforces instead of rattles their current beliefs.

This Oatmeal comic illustrates this phenomenon nicely.

Anyway, this effect is also linked to our friend, the amygdala. The bad news is you can not get rid of your amygdala. The good news is, giving it some time to calm down, as mentioned before, and being aware of this effect can help you get to a state of openness and willingness to learn.

Curiosity and compassion helps to deal with criticism during code reviews

This brings me to point three: curiosity. Yes, curiosity is your main success factor to resolve conflicts during code reviews. You do not have to fear the opposing view in the pull request anymore, but you can exanimate it with a curious mind.

Why does your colleague think this isn’t a good idea? What are the advantages and disadvantages of the alternative solution?

Finally, you should have compassion and empathy for all involved in the code review, including yourself. Take the viewpoints of all code review participants into account. And listen to the code review feedback. Actively listen to what your colleagues have to say. Do not listen with the goal of counter-arguing. Listen with the goal of understanding the code review feedback. This will lead you to the “right” solution, independent of whether you accept or reject the request for change. Handling conflicts and criticism in code reviews with compassionate curiosity will help find a solution that strengthens interpersonal relationships between team members, instead of harming them.


I prepared an exclusive Code Review e-Book for my e-mail subscribers packed with code review best practices and case studies. Get the 20-page insights to code reviews now. Not a subscriber yet? Just sign-up.

Get Weekly (Reseach-based) Software Engineering Tipps

* indicates required

Dr. Michaela Greiler

I make code reviews your superpower.

Leave a Reply

Your email address will not be published. Required fields are marked *