How would you describe your experience when someone reviews your code?
Many developers report this is a source of stress, conflicts, and even power and ego struggles.
The above-described situation can be framed as a psychological safety problem.
Psychological Safety is key in team dynamics and was identified as the most important factor that predicts Google’s successful team in Google’s team effectiveness research.
“Psychological safety …is a shared belief that the team is safe for interpersonal risk-taking. In psychologically safe teams, team members feel accepted and respected”(source: Wikipedia)
“Protecting people is the most important thing we can do because it frees people to take risks and unlocks their potential.” (source: Industrial logic: Anzeneering)
Code reviews are a frequent opportunity for building (or jeopardizing) Psychological Safety in the team.
The first step is to acknowledge and pay attention to psychological safety.
Here are 8 tips for leveraging code reviews to build safety –
Regularly discuss with the team – Start talking openly about the review process. In the team’s retrospective meeting, ask “how do you feel about this process?”, “What are the main insights we learned?” As a leader, it is recommended to share your own mistakes (be vulnerable) to free people from their defensive mode.
Code review together – Make the code review a great learning experience by avoiding offline reviews: review the code together – pair review (it may sound initially like a waste of time but give it a try, you will probably not regret it).
Be empathetic – invest in explaining alternatives and asking clarifying questions. Don’t be judgemental, use open and curious questions.
Be positive – approach the session as a learning experience and use a positive tone.
Explain coding guidelines and best practices – In your comments point to standards and guidelines that were agreed to and defined (e.g., “this is how we write python here”).
Frequent small reviews – Try having frequent reviews, on small changes, to get fast feedback. Short and focused discussions are easier to absorb.
Separate the wheat from the chaff – is this comment really important now?
Have a clear “Definition of Done” – For example, what level of the automated test is expected?
Code reviews play a central role in the dynamics of development teams. A poorly executed process may be a significant source of delay and bad morale. A great process provides great learning opportunities and grows a high-performing team that people want to be part of.
Yael & Yaki