How to make good code reviews and win colleagues?
Samer Azani Jul 21
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 criticising 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.
1) Adhere to coding guideline or make one with your team members.
Use the right words:
2) Avoid using negative words and comments like "Remove", "Change", "Not needed", "No", "Bad", "I don't like this" etc...
3) Don't use sarcasm.
4) Avoid referring to code as "mine", "yours", or "theirs".
5) Ask questions instead of giving orders. Use questions like "Do you think this would be better?", "What do you think about...?"
6) Be positive. Don't say words like "I didn't do this", "It wasn't me" etc...
7) Explain the reason behind your comment and how it will improve the code.
8) Express yourself clearly and provide arguments. If needed, link to other code snippets or PRs.
9) Ask for clarification if the code is unclear. If there are too many questions it would be better asking them in person.
10) Be clear in the feedback. If a lot of discussion is needed it can be done in a different session.
11) Learn from the comments and how others tackle the same problem.
12) Don't take it personal, code reviews are about the code and not you as a person.
13) Accept all feedback. Whether you are a Junior or Senior take feedback positively.
14) Be open to other ways of writing code or methods.
15) Don't turn the feedback into an ongoing argument. You can always talk to the commenter in person.
16) Be supportive. Help by pair-programming or showing an example.
17) Be responsive. Provide more information or clarification in the same day or after one day.
18) Be quick. Don't leave too many Pull Requests open. The codebase will grow, and the PR will stay behind.
19) Give positive feedback when the PR is accepted, like using the Like emoji or saying words like "Great, well done".
20) 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 review 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.