Better Code Reviews

Become a more effective and empathetic reviewer

Alex Persian
Jul 22, 2019 · 4 min read
©Asana https://blog.asana.com/2016/12/7-ways-to-uplevel-your-code-review-skills/

Reviewing code is an daily occurrence for developers. It can be a humbling learning experience, but it can also turn into an egocentric process. Over the last few years I’ve learned some best practices, either through personal experience or excellent advice from peers, that have helped me to become a more effective and empathetic reviewer. I wanted to share some of this information, in the hopes that it will help others. This short post is broken into two main parts: 1. getting the best feedback on your work and 2. providing great reviews for your peers.

Structuring Your PR’s to Make Their Life Easy

@iamdeveloper https://twitter.com/iamdevloper/status/397664295875805184

Avoid massive changelogs

  • If a piece of work requires more than 600 lines try to break it into smaller logical chunks that can be reviewed individually.
  • No one wants to be sent a 1000 line PR monstrosity. Good reviewers will often reject a pull request of this scale; they know from experience that they probably won’t be able to to review it effectively.

Structure for comprehension

  • Commit changes frequently to reduce their scope. For larger pieces of work it is far easier for your reviewer to focus on what’s important when the commits are small.

Short-circuit possible confusion

Provide enough context

Approaching a Teammate’s PR Efficiently and Effectively

Review in a timely manner

  • The maximum time from a request and the first review being completed should never exceed one work day.

Gather context if it’s lacking

Start at a high level

  • This also cuts down on the possibility of bike-shedding, which detracts from the more important and impactful aspects of the work.

Handling disagreements

Requesting changes

  • Small issues should be addressed through a project style guide — but that’s a different topic altogether.

Empathy

©xkcd https://imgs.xkcd.com/comics/code_quality.png
  • Most importantly, remember there’s another person on the end of your review. Provide feedback in a helpful and constructive way. Always think about how you would want to be given feedback, if it was your pull request that was being reviewed.

These are some of the pieces of advice I’ve gained from my peers and from personal experience over the years. Each has been directly applicable to me at one point or another, and I hope that they will each help you out as well.

Better Programming

Advice for programmers.

Alex Persian

Written by

iOS engineer @ Spotify

Better Programming

Advice for programmers.

More From Medium

More from Better Programming

More from Better Programming

More from Better Programming

More from Better Programming

Why Do Incompetent Managers Get Promoted?

1.8K

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade