Handing Code Review Feedback
When it comes to code review, the advice generally given is ‘critique the code, not the coder’ and ‘remember, critiques of your code are not personal attacks’.
Those are things that most of us know intellectually.
But when it comes to really knowing these things emotionally, how many of us struggle?
What if, despite our best efforts, some of us still feel terrible when our code is critiqued? What if we have a hard time dealing with that emotionally?
I’ve thought a lot about how my own mental health issues have had an effect on how I embrace or reject criticism. The notion that ‘critiques of your code are not personal attacks’ took me a long time to internalise.
Over the years, I’ve developed a few techniques that have helped me get better at accepting feedback on my work, so I thought I’d share them with you.
First, let me tell you a few specifics about my mental health: when I began programming professionally, I was in a bad place with my mental health. Many years of anxiety and depression were catching up with me, and I hit rock bottom when I realised that I was codependent and I needed help to recover.
I started seeing a counsellor, and together we worked on a lot of things. My mental health improved to the point where at the moment, my anxiety is very low, my depression is temporal, and I’ve unlearned a lot of harmful behaviours. I’m pretty proud of this.
On the list of behaviours that codependents often exhibit are these:
- they judge what they think, say, or do harshly, as never good enough.
- they value others’ approval of their thinking, feelings, and behaviour over their own.
Certainly, these behaviours are not the exclusive territory of codependents, and I’m sure that many of you can relate to them.
So, what used to go through my mind when the code review feedback came in?
- This person thinks I’m a terrible developer
- Why didn’t I already know that? I am a bad developer
- [other developer] would have done a much better job on this feature
- I am so stupid for not already knowing this
I bet that sounds familiar to some of you, though.
Not only was I beating myself up, I was also doing what my therapist would call mind-reading. I would take any innocuous feedback that the reviewer gave, and assume the worst.
Lacking confidence, and believing in my own crap-ness as a person meant that I would take helpful feedback and invent shades of meaning that the author never intended.
I would spiral into shame, my anxiety would take over, and I would be an internal wreck. I hated feeling like that all the time. I hated feeling anxious about submitting my work for review.
When there was a bug in my work, all hell broke loose. Driven by shame, I would work feverishly at night to correct my mistakes. I would berate myself for hours and cry myself to sleep.
Things were bad.
Things started getting better.
During my therapy sessions, I worked a lot on cognitive reframing. Essentially, cognitive reframing involves recognising irrational and damaging thoughts, and challenging them. For me, the short-term goal was to stop the shame spirals before they got going. The long-term goal was to change my thought patterns and establish healthier neural pathways.
Though I mostly focussed on personal topics in therapy, I began to use cognitive reframing to help me with my work. So, here’s the weird trick:
I started thanking people for their code review feedback and for reporting issues to me.
It seems pretty simple and obvious, but making a conscious effort to do so served a few important purposes.
The step of saying ‘thank you’ helped me stop and reflect. It forced me to take a moment to appreciate the process. Code review and reporting issues are processes that help me learn and produce better work as a developer. Skipping a ‘thank you’ meant that I would jump right to the specifics of the review, without appreciating the purpose of the process.
Focussing on the purpose of the process helped me to depersonalise the critiques, and I started to view everything in a more collaborative way. It was me and the reviewer working together to make the code better — not the reviewer shitting on my code and looking down upon me.
Over time, I’ve become much more calm, rational, and welcoming of feedback (though I still have a way to go, I’m definitely not an expert).
So, give it a try.
If thanking your colleagues aloud or over chat seems too difficult and awkward at first, just do it silently in your head. You’ll eventually find a way to express it that works for you.
To be absolutely clear, I think there’s an onus on your team and your company’s management to make sure that a good critique culture develops. None of this individual work is possible without the support of a team that collaborates, avoids personal blame, and encourages each other.
I also think it’s also a good idea to take a look at your own responses to criticism so that you can become a more resilient and healthy coder.
Let me know how it goes ✌🏻