Code Review Best Practices for 10x Engineers

As developers, we are all too familiar with code reviews. Having another pair of eyes take a look at our code can do wonders; it shows us multiple aspects of same code that we would not have noticed otherwise.

Code Review (also: CR) — is a practice involving the review of code written by a programmer by another person in order to reduce the risk of errors and adapt it to company code standards and architecture.

How To Make A Good Code Review? Goal of code rewiewing? What mistakes should you avoid? What’s the benefits of code reviewer? This article will answer all of these questions, and maybe even make you fully understand that effective code review can do wonders not only for the product itself, but also for the reviewer & team.

Code Review Goals

  • Higher-quality code
  • Better Collaboration and improved solutions to problems
  • Sustainability & Maintainability of code

Code Review Best Practices

1. What to Look for in a Code Review?

  • Am I able to understand the code easily?
  • Is the code written following the coding standards/guidelines?
  • Is the same code duplicated more than twice?
  • Can I unit test / debug the code easily to find the root cause?
  • Is the code secure and scalable?
  • Is this function or class too big? If yes, is the function or class having too many responsibilities?
  • Check out a detailed code review checklist.

2. How to Write Code Review Comments?

  • Be kind.
  • Explain your reasoning.
  • Balance giving explicit directions with just pointing out problems and letting the developer decide.
  • Encourage developers to simplify code or add code comments instead of just explaining the complexity to you.
  • Proper tags in comments [Suggestion, Question, Niptick, Issue, Blocker].

3. Communicate Goals and Expectations

  • Setting right expectation for people new to code by sighting examples, references & documentation
  • Use proper tags [Suggestion, Question, Niptick, Issue, Blocker] while commenting
  • For better code, don’t write “what” without “why”
  • Self-review changes before submitting for peer review

4. Include Everyone in the Code Review Process

  • Any one can review, irrespective of experience/designation.
  • Open to ask help from others for reviewing certain piece of PR.

5. Foster a Positive Culture

  • Tone of the Review matters. Be polite while conveying message on PR.
  • Approving vs Requesting Changes. Don’t approve because you are forced, and don’t request changes because you want to.
  • From Code Reviews to Talking to Each Other whenever required.
  • Don’t be spiteful over mistakes when reviewing code
  • Make sure to sometimes say something nice during your code reviews
  • Instead of giving orders, make suggestions
  • Give Feedback That Helps, Not Hurts.

6. Automate to Save Time

  • Look to automating repeated work like linting, code quality check, executing test cases etc
  • Add shield, hooks where ever possible to reduce manual work.

Benefits of Code Reviewer:

  • Sharing knowledge helps team to grow together, and improve leadership skills
  • Learn from peers, as every developer and their coding style, knowledge depths, project understandings are different, so you will always from them.
  • Remain upto date with all features. Being part of a big team it’s very difficult to be aware of all the contribution from other developers. Code review helps you to be on top of it.

Wrapping up

Woo! We are done with the Code Review Best Practices for 10x Engineers.

Was this article helpful for you? Let me know in the comments below if you have any questions or thoughts! I’d love to hear them :)

Thanks for reading. Did this article help you in any way? If I did, I hope you consider sharing it you might just help someone who felt the same way you did before reading the article. Thank you.

Sharing makes you bigger than you are. The more you pour out, the more life will be able to pour in.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chirag Goel

Senior Software Engineer @Microsoft | Blogger | Youtuber | Mentor | Entrepreneur. I’m the intersection of Technology, Business and Design.