Developers should look forward to code reviews, not dread them

Don’t be a jerk

Developers need to submit code free of preventable mistakes

  • A properly configured linter, supplemented with custom rules if necessary
  • An agreed upon style guide. Defer to an established standard like Google, AirBnb, Sun/Oracle to avoid battles of opinions
  • A common formatting configuration for IDEs (like editorconfig)
  • An automated code formatter using a git hook (like husky/lint-stage/prettier)
  • Documentation for known anti patterns
  • Documentation detailing what to look for in a code review. (e.g: scope, correctness, design and style, in that order. This is from CS50)
  • Unit tests with adequate coverage

Reviewers should be helpful and meaningful

  • In an international context, use simple global English, free of idioms and cultural references.
  • When possible, reference official documentation and established best practices.
  • Emojis are useful to convey context in the absence of body language.
  • Comments should be meaningful. I once left a comment that was just one line of code in a pull request. This degenerated in a full blown debate on whether to use map or reduce. After about half a dozen comments from my team mates, I ended the conversation by explaining that the point of my comment was to show the developer that their for loop was not necessary and could be replaced by a call to an Array method. I obviously failed to make my point. My comment should have been “You can shorten this code by using reduce” with a link to the MDN documentation.
  • Comments are not meant to be conversations. Use your phone/slack/corporate instant messenger/email. If you’re in the same office, walk over to that person’s desk. Value human interactions.
  • Remember the golden rule, don’t be a jerk, don’t be condescending, don’t be pedantic and don’t be patronizing.
  • Learn how to give and receive feedback: assume positive intent, be clear, be helpful, think about a time where you may have given/received similar feedback, etc…
  • Comments can be used to give praise!

--

--

--

Previously Paris and Geneva, currently New York. Can also be found at https://dev.to/arnaud

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

I can’t help you be productive — I literally just spent almost two hours clicking and refreshing…

How to create an AWS Lambda Layer

C# Coding Guidelines for better programming

C# Coding Guidelines for Better Programming

The One Skill You Need to Develop as Programmer

Stop writing code inside main method

Rapidly Learn Python: Framework

Reduce Cost and Increase Productivity with Value Added IT Services from buzinessware — {link} -

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
Arnaud Dostes

Arnaud Dostes

Previously Paris and Geneva, currently New York. Can also be found at https://dev.to/arnaud

More from Medium

Can tech companies use code reviews to keep their employees psychologically safe?

Creating meaningful pull requests

Does Test-Driven Development produce clean code?

Relationship Table Anti-Pattern