The 5 Golden Rules of Code Reviews

Always remember — it’s a human being on the other end of the review

The first Golden Rule of Code Reviews is simple: Review other people’s code like you’d like your code to be reviewed.

  • Be kind– even if there’s room for improvement, the message can be delivered with empathy
  • Be clear– make it easy for the reviewer to understand what you are saying. Importantly, if you have constructive feedback to give, be direct about it. Avoid a “crap sandwich” that starts with positive feedback about the code, even if it’s genuine, before getting to your suggestion for improvement.
  • Be specific — The more granular your feedback can be, the more helpful it is to the Author.

Give clear suggestions or recommendations

Never tell someone that the code needs to be fixed without giving suggestions or recommendations on what to fix or how to fix it.

Always assume good intent.

Code may not be written how you would write it. Let’s say that more clearly: code is rarely written the same way by two different people. After all, code is a craft, not a task on an assembly line.

Clarify the action and the level of importance.

If you are making an optional suggestion, for example, a “nit” that isn’t necessary before the code is approved for production, say so clearly.

Don’t forget that code feedback — and all feedback — includes praise.

It goes without saying that the key benefit of doing code reviews is to make the code better and fix issues.

--

--

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