How to make good code reviews and win colleagues?

Code reviews do not only improve the quality of code but are a great tool to learn from others and share experience. Doing and having code reviews is not an easy task. Pointing to or criticizing your colleagues and peers is not something someone would like to do daily. Therefore, doing it in a constructive and positive manner would be beneficial to both the reviewer and reviewee.

Prepare:

  1. Adhere to coding guideline or make one with your team members.

Use the right words:

  1. Avoid using negative words and comments like "Remove", "Change", "Not needed", "No", "Bad", "I don't like this" etc...
  2. Don't use sarcasm.
  3. Avoid referring to code as "mine", "yours", or "theirs".
  4. Ask questions instead of giving orders. Use questions like "Do you think this would be better?", "What do you think about...?"
  5. Be positive. Don't say words like "I didn't do this", "It wasn't me" etc...

Clarify:

  1. Explain the reason behind your comment and how it will improve the code.
  2. Express yourself clearly and provide arguments. If needed, link to other code snippets or PRs.
  3. Ask for clarification if the code is unclear. If there are too many questions it would be better asking them in person.
  4. Be clear in the feedback. If a lot of discussion is needed it can be done in a different session.

Accept:

  1. Learn from the comments and how others tackle the same problem.
  2. Don't take it personal, code reviews are about the code and not you as a person.
  3. Accept all feedback. Whether you are a Junior or Senior take feedback positively.
  4. Be open to other ways of writing code or methods.
  5. Don't turn the feedback into an ongoing argument. You can always talk to the commenter in person.

Support:

  1. Be supportive. Help by pair-programming or showing an example.
  2. Be responsive. Provide more information or clarification in the same day or after one day.
  3. Be quick. Don't leave too many PRs open. The codebase will grow, and the PR will be behind.
  4. Give positive feedback when the PR is accepted, like using the Like emoji or saying words like "Great, well done".
  5. If a feedback helps, inform the reviewer how you find that helpful. Use words like "Good catch, thank you" etc...

Having a constructive and positive code of conduct will foster a healthy work culture and allow team members to express themselves freely without the worry of shame and negative feedback. This will create an environment where team members feel respected, valued and productive. At the end it will allow an agile environment, knowledge sharing and growth.

Show Comments