Code Review Anxiety | Carol Lee | Monktoberfest 2024

Share via Twitter Share via Facebook Share via Linkedin Share via Reddit

Get more video from Redmonk, Subscribe!

Tell someone you feel anxious about giving or receiving code reviews, and you’ll likely be told that it’s a “junior developer thing that you’ll eventually get over,” then given tips for writing “cleaner/ better code.” While frequently well-intentioned, this advice gives developers the message that there’s something wrong with them or their code if they experience code review anxiety – a message that is not just inaccurate, but even damaging. So what can you do about code review anxiety? In this talk, Carol Lee shares the story of her empirical research conducted with software engineers and developers across industries experiencing code review anxiety.

Transcript

Hi, my name is Carol and I’m talking about using clinical science, fun fact I’m a clinical psychologist, kind of random, I know, to tackle this lovely thing called code review anxiety.

  I so I want to start with a little story first, OK, so two years ago I was a psychology professor. So the thing about being a psych professor is that you still conduct research, you still conduct analyses, and you still write code. What you don’t do is use this lovely thing called GitHub. So a few years ago I started as a scientist and the manager was like, you gotta get ramped up on GitHub and I was like, OK, fine.

  So I open up the GitHub, and I see that there’s this thing called a repo, and it says success lab on it, so I click on it, there’s a place to put your code in and I’m like, code goes in here, I’m so smart. So I copy my entire data analysis book at the time which is like a thousand lines of code and I just copy and paste it in and I’m like, this is a GitHub, it’s wonderful. And I went back to my analysis playbook, made some changes to it, made some edits, add some things, delete some things, as one does and I have this beautiful brilliant moment where I’m like you have to update the repo, Carol, duh! So I go in and copy and paste the entire workbook again and paste it into GitHub and I’m pretty stoked right now, I’m so proud of myself. I didn’t just do GitHub once, I did it two things,

  I’m so proud of myself that I don’t just tell my team about this, I also tag the entire channel for some reason, so like everybody is like forced to celebrate with me. Like, a totally normal person!

  And I’m like, this doesn’t require review, because I probably did it right. But I just want to publicly say that we have code in GitHub. Feeling really pumped and proud of myself for diving into GitHub, TBD.

  My teammates who were very kind and hadn’t seen what I’d done yet, also react very positively. My manager here, you seen here also hasn’t seen what I’d done yet, said phenomenal. She’s in for a ride.

  Some things I really love about this. First I love that I say, “doesn’t require review unless you really want to” there’s a lot of little unearned confidence there. And I also say, TBD if I actually did it right. And that was kind of weird. Do they just read lines and lines all day? This is crazy.

  And of course I did not do it right!

  So my manager sends to me some really tiny feedback and even though the feedback is really kind, I have any first experience with code review anxiety, OK? And because of that anxiety, I have decide that was a really stupid mistake, I should have known better, she regrets hiring me, because I’m so incompetent. By the way, I have no idea why this picture was taken or where, I’m just very distressed about these French fries for some reason and that’s OK, we all have these moments, right?

  So what is code review anxiety? You can think about this as fear of judgment, criticism and negative evaluation while giving or receiving code reviews, so put very quickly it’s any anxiety you experience about a code review, OK? So the thing about code review anxiety is that it’s actually quite common and in fact, anybody can experience this, so in my research example, we saw that code reviews of anyone between 1 and 65 years of code review experience, so this isn’t an experience issue. Anybody can have this.

  Just to kind of highlight this, raise your hand if you’ve ever felt anxious about giving or receiving a code review. Yes, like it happens, OK?

  All right. Now I want you to raise your hand if you’ve ever actually talked about that anxiety with your teammates? So a lot less of us, right? And that makes a lot of sense, because we don’t typically talk about our anxious experiences in the workplace. This is actually kind of a problem, though, because when we don’t talk about our experiences like code review anxiety, it makes those experiences really invisible and then we tend to feel really alone in them, even though we’re not, right? We’re not actually alone in this experience.

  And so very quickly, like the whole ethos of this project became like you are not alone in your code review anxiety, right? You’re not crazy, you’re not unskilled for having it, because code review anxiety is quite normal.

  I also really like more importantly wanted to show people that there’s something that you can actually do about the anxiety, because just because something is normal doesn’t mean that it can’t still be a blocker, right? Can still get in the way of our lives, wellbeing, etc., etc.

  And that makes a lot of sense. I’m a scientist, I can tell you, one of the primary outcomes of anxiety is actually avoidance. So in the context of code review anxiety, folks will procrastinate on code reviews, a lot of folks avoid doing them completely or they’ll disengage on them, like rubber stamping, etc.

  it’s a really great method in the short time. Now your anxiety is gone, and you’re like, wonderful, right? But it also has a lot of long-term consequences.

  For example, it prevents you from accessing any documented benefits from things like code reviews, the things like code quality, code security, learning and knowledge transfer, collaborative and creative problem solving, trust and community building, all of these lovely things.

  So kind of like in a nutshell, if we want to benefit from things like code reviews, we actually have to find a way to mitigate that code review anxiety first, OK?

  So how do we mitigate it away? If you go onto the interwebs, as one does, there’s a lot of opinions about how to reduce anxiety, and the problem with these, like, opinions on reducing code review anxiety in particular, is that they don’t work and they actually make your anxiety a lot worse, and these are very well intentioned, so if you do these things, like no DR, I get it.

  He so the first things that folks will do is they’ll dismiss code review anxiety as something that you grow out of as you get more experienced. So you might hear things like don’t worry, you’ll get used to it, you’ll kind of grow out of it. So this is a problem, because like we just mentioned, anybody can have code review anxiety. It’s not actually an experience thing.

  Not to mention if you really did kind of actually grow out of this thing, you kind of want to give support to people in the interim, right? You don’t really want to say, hey, things suck, they’re going to keep sucking for several years, oh, well, right? Like, that’s not super-helpful.

  The second thing that you’ll often see is that folks will focus on coding ability instead of anxiety, because that’s probably a little bit more comfortable place for us to play in, right? So you might hear folks say things like here’s how to write better code, here’s how to write cleaner code, if your code is really solid, there’s nothing to be anxious about.

  The problem with this is you can of course feel very, very anxious about something that you did very, very well, right? They’re not mutually exclusive. So I like to say that anxiety isn’t merit-based, it’s not something that you deserve, it’s not something you earn your way out of, it’s like literally something that just kind of happens to all of us, right?

   AUDIENCE:  Whoo!

  [applause]

  So how do we do this in a science-driven way? So in the clinical sciences, the first step is to develop an empirical model. We do this because it helps to identify what are the key mechanisms leading to that anxiety? Take that targeted approach rather than a kitchen-sink, approach, like just throw things at it and be like, hope that works.

  So this is our model of code review anxiety, generate rating something called a path analysis, so here you see that when you’re presented with this code review situation, you have three cognitive biases that are triggered. The first is low-anxiety self-efficacy. This is when you feel like you can’t handle or manage your anxiety. So you might feel things like, I don’t really know if I can do this, how do I manage this, can’t handle it, don’t really want to engage with this.

  Second is a cost bias, this is how you overestimate the cost of something instead of saying, oh, well, I made a mistake, that kind of soft “oh, well,” you made a mistake and it’s going to end my career, right? You really overestimate the cost.

  And then finally a probability bias. So instead of saying, like, that may or may not break production, I mean, whatever, right? I’m thinking every time I make a mistake, I’m going to break production and it’s going to be terrible.

  So you see in our model that some elements do increase that code review anxiety and of this, the self-efficacy is that at a minimum our intervention leads to, you know, I keep doing that — got it, OK, needs to target the anxiety self-efficacy, right

  We often see that anxiety does lead to avoidance, obviously. Really telling us OK, if we want to reduce that avoidance, we really need to engage with the anxiety. So we have our major mechanisms here. So we want to do an evidence-based intervention, I engage in a single session cognitive behavioral workshops. Cognitive behavioral workshops have been shown to decrease anxiety, decrease avoidance and improve anxiety self-efficacy. And also make it a single session over Zoom, because it’s just more accessible, many folks can tune in around the world, folks don’t have to travel, there’s lower time burden, etc., etc.

  So here is our intervention. Consistent with cognitive behavioral approaches, this has four major steps or parts. The first step is to actually teach folks how to assess their own anxiety. We do this first because it’s really, really hard to do something about your anxiety if you don’t really know what’s happening. Essential to most things, right? You’ve got to know what’s happening if you want to do something about it. The second is to reduce physiological arousal. We do this because it’s really hard to think or act rationally if you have intense physiological symptoms. So if I am hyperventilating, I’m not thinking gosh, how can I manage this code review in a rational manner, right? I’m thinking, oh, my gosh, I need to breathe, right?

  Next we teach people how to challenge biased thoughts. Because code review anxiety makes us think about really bad things about us. I’m not thinking, oh, my gosh, I’m a goddess, you’re thinking, oh, my gosh, I’m a trash hole, right? Not great things about yourself.

  And finally to reduce avoidance because avoidance does actually make things worse in the long term.

  I’m not going to go over all of these things for the sake of time, but I am going to go over challenging biased thoughts. OK, so the first step of challenging biased thoughts is to actually idea those thoughts, because again, you can’t challenge a thought if you don’t even know you’re having it, right? So we’re going to bring back sad, distressed Carol here and she has this thought of she regrets hiring me because I’m so incompetent, right? Just to give you a sense of other people’s thoughts, these are real thoughts from real participants. Every time I get a code review, I’m thinking, this is how I die.

  Kind of more heartbreakingly, though, someone said, I will never get the developer that reviews my code to respect or like me.

  Another person said, I’m always going to be the least smart and competent person on my team.

  And then, actually, a staff engineer said I have too much experience to be freezed on this type of task. I feel really ashamed.

  So you can imagine if you’re walking into a code review and thinking, man, this team is never going to respect my work, right, you’re not really setting yourself up for less anxiety, you’re actually setting yourself up for so much more anxiety. What an anxiety-provoking situation, right? Now the stakes are even higher.

  After you idea those thinking traps, you’re going to go ahead and verify that it is a biased thought by identifying thinking traps.

  And so if you think about a thinking trap as like a cognitive bias that happens when you’re really anxious. I’m not going to go over all of these, but I’m just going to go over the ones that I see in my thoughts here. So first we definitely see some catastrophizing, I am predicting that something really bad is going to happen, even if I don’t have any evidence of it, right? At no point am I going to say, hey, Carol, you know who’s really incompetent? You!  At no point, like, no evidence of this thought, whatsoever.

  I also engage in dichotomous thinking. I’m going to considering the extremes. I’m either a superstar scientists or I’m completely incompetent, right?

  Also, engage in some mind-reading here. I have no idea what my manager is thinking. I cannot read her mind.

  And then finally, I engage in overgeneralizing, I take this like single mistake and well now I’m incompetent, right? A single mistake here.

  We have identified that these are biased thoughts and the next step is to challenge it. We don’t want to say, there’s a negatively biased thought, oh, well, right? We want to challenge this thought.

  So I’m going to go through my typical thinking. She probably regrets hiring me because I’m so incompetent. And then you can ask yourself, OK, Carol, am I 100% sure of this? And if the answer is sure of this? No, I’m not even 20% sure of this, next I ask myself am I placing unrealistic and unattainable standards on myself that I wouldn’t expect another person to achieve? And the answer to that is yes. That was a really silly mistake, but I also wouldn’t expect anyone who’s never seen or used GitHub before, to use it perfectly, right? Things happen.

  And finally asking myself, OK, does making a mistake really mean that I’m incompetent? And the answer is no, everyone makes mistakes, superstar scientists make mistakes, it doesn’t mean that we’re incompetent, it just means that we are quite human.

  So from this, I went to develop a rational response. This is more realistic and self-compassionate point of view. And so I might change my thought to hey, everyone makes mistakes, Carol, it’s just part of learning, right? Like, that is a fact.

  So you might be thinking OK, cool technique lady, does this actually work, right? Like, that’s kind of important. It does. I wouldn’t be up here if it didn’t. But just to give you a kind sense of this, the next step is to actually test intervention.

  And I do this empirically. I did this with 59 developers and did this with a randomized controlled still. This is a standard method for clinical trials and I also do this because it makes sure that effects are due to intervention and not just because anxiety fluctuates over time. You’re not the at the same level of anxiety all day every day. It just naturally changes. And so this helps you make sure OK, this change is actually because of this workshop, not just because things change over time, right?

  So here are our results. The first result, it does decrease anxiety, yay!  Developers felt less code review anxiety and you can see here comparing the two groups here, I think the white line shows up very well, I’m sorry, but I think if the look apartment the workshop graph there’s a larger decrease in anxiety scores, compared to the control group where there’s not much decrease at all.

  We also see that our other tracks of self-efficacy was much higher in folks who had the intervention, so that lets us know, OK, when folks go through this intervention, they’re better able to tolerate their anxiety and they’re better able to manage their anxiety, which is what we want, right?

  And then finally, kind of like a fun bonus finding: You are intervention increased self-compassion, and so devs were more kind towards themselves, and were much more validating towards themselves, which is awesome. Again you see a bigger increase in that workshop group in self-compassion scores, whereas, there’s not much change at all in the control group.

  So how can I put this into practice, right? You’re like, cool, love that for you, but it wasn’t actually in the study, so how can I take advantage of this? First, you can talk about code review anxiety with your team. Like I said earlier, not talking about that experience makes our experience invisible. And when our experiences are invisible, we feel very alone in them, even though we’re not, OK?

  Again, I think it’s really important for folks to know that they’re not alone in their anxiety, they’re not crazy, they’re not weird, they’re not unskilled for having anxiety, there’s nothing wrong with them, right? Because code review anxiety is really freaking normal, and also most importantly, that we can in fact do something about that anxiety.

  Just to kind of hammer this home a little bit: Here are some quotes from former participants who posted publicly or from folks who read the paper somehow and decided to talk about it in their teams.

  Someone said: I left having never felt so seen. To be in a Zoom with other developers who experience similar levels of anxiety was truly priceless, even after the session ended, a few other del verse and myself stayed on with Carol for about 20 more minutes, the psych safety of that Zoom real felt special and I wanted to absorb it for as long as possible.

  It just feels so dang good to feel like, hey, this thing that I’ve been struggling with, I’m not weird for having it. Here’s an entire 30-person Zoom room of other people who experience the exact same thing. That feels really good and powerful to talk about that anxiety.

  Another person said that knowing that code review anxiety is an almost universal experience has helped with some feelings of Imposter Syndrome, acknowledging that it’s a real thing, knowing other people regardless of experience or skill have similar thoughts and experiences. Again, knowing that something is normal, knowing that you’re not crazy for having it, right? And then also knowing that there’s something you can actually did about this anxiety that is really helpful for people.

  And then finally, somebody who was not in the study but found the paper and ended up reading it with their teammates, talked about the lines, we ended up having a few people commenting along the lines of I’m so glad to hear this isn’t a “me” problem. If you are like, OK, I need a little bit more, which is totally fine, we actually created this code review anxiety workbook. This is a self-guided and self-paced workbook. It distills the actual intervention that we tested into this like lovely workbook. You can go onto the web page and work through it yourself there, you can download it, try it out, do whatever you want with it, work on it by yourself, with your teammates. This is like yours to use, OK?

  So the TL;DR of this whole thing, first of all code review anxiety is normal. Know that it impacts developers across the experience level. It’s not an experience thing, right

  Code review anxiety can be a block. It leads to things like avoidance, procrastination and maintained by things like low self-efficacy. And finally we can in fact do something about it, a single cognitive behavioral workshop can decrease anxiety, increase anxiety self-efficacy, and increase self-compassion.

  It’s going to be published in Empirical Software Engineering soon. You can feel free to find it there. Yay!

  [applause]

  

  And finally, my teammates who were on this project with me, just a shout out to them. And thanks!

  [applause].



More in this series

Monktoberfest 2024 (8)