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!