Things I wish I knew about code reviews before starting my journey in tech 👨💻
Code reviews are a great mechanism for you to learn as well as teach others how to become better developers. This process involves a systematic examination of the code to identify potential issues, bugs and security vulnerabilities.
Sharing few of my learnings on doing good code reviews :
1. Choose your words tactfully. Frame your feedbacks and replies as suggestions instead of command (“Do you think putting X in Y class is easier to maintain” not “Put X in Y class”) and focus on the code itself instead of the author (“Looks like A is missing in this struct” not “You forgot to put A in this struct”).
2. Write clear and specific comments. Lead by examples and try providing code and design references wherever possible.
3. Don’t block a review on matters of personal preference or style. A common way to do this is to use a tagging system, like prefacing all non-blocking comments with “minor:” or “nit:”. This gives the author an opportunity to consider all your advice and freely discuss, rather than seeing every comment as an obstacle.
4. Don’t be afraid to express your confusion once something isn’t clear. If you cannot understand a piece of code or it’s taking too long, leave a comment or hop on a call to discuss it.
5. When you notice that several of the author’s mistakes fit the same pattern, don’t flag every single instance, instead call out one or two separate instances of the pattern and ask the author to fix the issues at other places.