Overcoming Anxiety in Code Reviews
Melissa Piper, Former UI Developer
Article Categories:
Posted on
Code reviews can feel overwhelming if you're a developer with anxiety. By changing your perspective and adopting a growth-centric mindset, you can conquer code review anxiety.
As a developer, your coding workflow likely includes creating a pull request (PR) on GitHub and tagging another developer on your team to perform a code review. If, like me, you’re a developer with anxiety, the code review process can be one you dread. Putting your code in front of fellow developers can increase your anxiety because you’re making yourself vulnerable to judgment, and you may feel like your worth and reputation as a developer are on the line. I’ve been there before (more times than I’d like to admit), but I’ve worked on a few strategies to assist in overcoming this anxiety.
Sources of Anxiety #
First, let’s explore why submitting PRs for review can be overwhelming for some developers. Everyone’s different, but there are a few common themes:
Fear of appearing incompetent #
You’re putting your code out there for other developers to review, which can be intimidating. It can feel like a test where you are expected to show off knowledge — with any shortcomings or perceived gaps in that knowledge revealed upon close examination.
Impostor syndrome #
If you’ve felt self-doubt about your skills as a developer, you may have experienced impostor syndrome. Inviting other developers to provide feedback on your code may reinforce these feelings if their feedback includes comments on things you think “you should have known,” or makes you second-guess your work.
Personal attachment and difficulty accepting feedback #
When you code, the resulting code can be viewed as a reflection of yourself. It’s personal, especially if you’ve spent a great deal of time on it. So, you may become attached to your code.Receiving feedback or a request to change something that you’ve spent so much time working on can feel like being asked to change a part of yourself.
Accepting feedback requires finesse. Compliments feel good and you want to welcome them with open arms, but constructive feedback might seem “critical.” After all, negative feedback is more likely to linger longer than positive feedback, and can make you hesitant to open your work up to similar “negative” feedback in the future.
The good news is once you’ve identified potential causes of anxiety when submitting PRs, you can do something about it. So let’s look at some thought processes to reduce that anxiety.
Ways to Reduce Anxiety #
Something that has helped me manage anxiety in code reviews is reframing my way of thinking about the review process, and remembering the true purpose of why they’re done:
- To catch preventable issues before they make their way into production. It’s less stressful to fix a problem on staging than it is to fix that problem on a live site!
- To foster collaborative ownership of the code base. Unless you are the sole developer on a project, everyone on the team should feel ownership of the code. Allowing feedback is a way for the team to collaborate and produce the best code base.
From there, you can change what code reviews mean to you personally. Try viewing code reviews as:
- An opportunity to learn, where each review offers a chance to pick up a new trick from a fellow developer that could work for them and help them grow going forward.
- A chance to see someone else’s perspective, where inviting feedback from a developer with experience in different types of projects or with a different background can help improve your code throughout your career.
Once you’ve reshaped your mindset, you can adopt several best practices to boost your confidence in your code before submitting your PR:
Always test code locally first #
Even if your update is minor, there may be some side effects that you hadn’t thought of. Always test your code on your own device before submitting a PR.
Use linters to remove small issues #
Consider using linters and formatters (for CSS, JavaScript, PHP, etc) to clean up small inconsistencies — even if your team doesn’t use them as a part of their development workflow. Doing so will make your code better from the get-go, and make code reviews easier on your colleagues too, as they’ll spend less time commenting on indentation issues and more time providing feedback on functionality.
Take a break before you submit #
If you’re still experiencing anxiety or are unsure of your work, take a short break. Sometimes the best thing you can do for your work is to walk away and come back later with a fresh pair of eyes.
Ask questions #
If there’s a piece of code that you’re unsure of, consider asking questions in your PR. GitHub makes it easy to highlight and comment on snippets of code. Use this feature to ask if there is a better way to approach a task, or just ask for open discussion of code that you know can be improved. Asking questions early in the review promotes targeted discussion of pieces that you aren’t as confident in, and acknowledges that you are looking to improve.
Acknowledge the bad feelings #
Even with mental preparedness and an internal pep talk, anxiety might still be there. There’s nothing wrong with acknowledging that these feelings exist, and that you’re working to move past them.
Anxiety in code reviews can feel like an obstacle, but with proactive strategies and a positive mindset, it’s a challenge you can overcome. Just remember: code reviews are not about personal judgment, but about learning, growth, and collaboration. Alter your perspective and embrace code reviews as an opportunity to improve your skills and become a better team developer.