Introduction
Code reviews can be critical for ensuring code quality.
However, the impact they can have on people is often overlooked.
In my previous article, we explored the role of mindset for code reviewers.
In this article, we’ll explore the role of mindset from the code author’s perspective.
Key Takeaways 🔑
✅ Mindset Matters:
Your mindset can make code reviews stressful and anxiety-inducing or turn them into a platform for growth and learning.
✅ Code Author Practices:
Don’t take feedback personally.
Be receptive to suggestions and ask for clarification and reasoning.
Show empathy towards reviewers and thank them for their suggestions.
✅ Continuous Improvement:
Take ownership of your code and actively seek opportunities for skill development.
Why Review Code?
A brief recap on code reviews…
Some teams insist on code reviews… others don’t…
Implemented in the right way, they can certainly bring benefits.
Benefits of code reviews include:
✅ Knowledge Sharing
✅ Code Maintainability
✅ Improved Code Quality
✅ Continuous Improvement
✅ Risk Mitigation (to some extent…)
The Code Author
Obviously, the code review can’t take place without someone to produce the code.
The code author tries to solve business problems with their code while adhering to team coding standards and best practices.
In doing so, they’ll receive feedback on their work…
👉 How they approach code reviews and handle feedback massively depends on their mindset…
Once upon a time
I remember working on a feature.
It got out of hand, and I changed more code than anticipated.
When I finished it, I was relieved…
I thought I’d need to start over several times…
Then, I raised my Pull Request, and reviewed my code again before hitting submit…
Suddenly, my head was flooded with thoughts of judgment about my code, even my abilities.
I remembered seeing past comments on PR’s that were less than pleasant…
I felt:
🔴 Nervous
🔴 Anxious
🔴 Stressed
I couldn’t delay my PR any longer, though…
I pressed submit and walked away from my screen to avoid seeing the onrushing derogatory comments.
I hid in the toilets for a while… 🤷♂️😱
Code Author - Fixed Mindset:
My mindset was closer to a fixed mindset.
With a fixed mindset, a code author:
🔴 Is reluctant to make changes to their code.
🔴 Views code reviews as a judgment of their abilities.
🔴 Is defensive about their code and may justify shortcomings.
🔴 Feels threatened by feedback and may perceive it as a personal attack.
🔴 Believes that their coding skills are fixed and immutable, leading to a fear of failure.
Code Author - Growth Mindset:
A code author will get much more out of code reviews if they approach them with a growth mindset.
With a growth mindset, a code author:
🟢 Views code reviews as an opportunity to improve.
🟢 Appreciates the time and knowledge of their reviewer.
🟢 Embraces feedback and is proactive in implementing it.
🟢 Takes ownership of their code and is open to making revisions.
🟢 Recognises that coding skills can be developed through practice and is committed to continuous improvement.
Why It Matters 🤷♂️
Your mindset significantly influences the outcomes of your code reviews...
🟢 It impacts the quality of your code.
🟢 It impacts how receptive you are to feedback.
🟢 It impacts your own confidence and professional growth.
🟢 It impacts your relationship with your team and how they perceive your work.
🟢 It impacts the overall effectiveness and success of your team.
Your mindset as a code author is even more important than the mindset of a reviewer.
You don’t control how someone else perceives your work.
You only control how you react and respond to it.
Your reviewer might not be well-versed in a growth mindset and a little terse with their communication…
With the right mindset, you can extract what’s meaningful for you to learn and grow.
And dismiss anything else that might otherwise cause you stress and anxiety.
Take Action 🔥
Remember, code reviews aren’t about being told off or made to feel like you’re not good enough.
They’re a great opportunity to learn, grow and benefit from other perspectives.
They’re about teamwork and getting to the preferred solution for your team.
The next time you’re involved in code review, consider these Dos and Don’ts:
Don’ts:
🔴 Be overly defensive:
Being defensive will cause you to immediately reject the validity of feedback and cause friction with your reviewer.
🔴 Seek perfection:
Seeking perfection will cause you anxiety and stress, making you feel worse about the comments you receive.
🔴 Doubt your abilities:
Doubting your abilities might dent your confidence when you receive comments questioning your approach.
🔴 Take feedback personally:
Taking feedback personally can impact your confidence and self-esteem.
Remember, it’s not a personal attack.
🔴 Submit incomplete or untested code:
Avoid submitting untested code. Run your automation tools locally before handing over your work.
Taking responsibility for your code will reduce any initial back and forth with the reviewer and give them confidence in your work.
Dos:
🟢 Embrace constructive feedback:
Approach feedback with an open mindset. It’s an opportunity to improve.
🟢 Show empathy towards reviewers:
Understand that reviewers provide feedback to improve the code, not to criticise you personally.
Your reviewer is likely very busy, so their comments might seem short.
However, always ask for clarification and reasoning where needed.
🟢 Thank your reviewer:
Thank your reviewer for their comments.
This will improve your relationship and show that you value their time and your own growth.
🟢 Take ownership of improvements:
Proactively address feedback and suggestions to enhance the quality and effectiveness of your code.
🟢 Maintain a growth-oriented mindset:
Continuously seek opportunities to improve your coding skills and contribute positively to the team.
Rich’s Recommendations
Check out my recommendations to improve your wellbeing, mindset, leadership or tech skills:
👍 Basma Taha - Your Guide to Fast-Track Your Software Engineering Career.
Newsletter: An Engineer's Echo
👍
- Writes about career growth, study abroad and life experiences.He's a Tech Lead at Meta.
Newsletter: The Hustling Engineer
👍 Crushing Digital - Dave Roberts
Get help to stand out in the market, land more interviews and get the job you deserve.
👍 NK’s weekly newsletter to learn system design:
Newsletter: System Design Newsletter
👍 Dev Leader’s weekly newsletter to help you level up as a software engineer!
From a Principal Engineering Manager at Microsoft.
Newsletter: Dev Leader Weekly
👍 John Crickett’s weekly coding challenge to help software engineers level up:
Newsletter: Coding Challenges
Closing
Code reviews can potentially destroy your confidence, halt team collaboration, and dampen a team's morale.
They can cause high levels of stress and anxiety….
However, with the right mindset…
They can ensure software quality and propel your growth as a software developer to new levels.
Remember
There's nothing more important than your own wellbeing!