Nov 2, 2016

The Human Side of Code Reviews

Code Reviews are one of the most effective practices for keeping code quality high. They help catch bugs early, keep best practices for code style/quality, and share knowledge with co-workers.

Since code reviews involve multiple people being critical of someone’s work, negative emotions often come into play. The following are some suggestions on how to handle the emotions of a code review and effectively communicate with code reviewers.

Expect changes going in
Go into a code review with the expectation that changes will be needed to be made. For this reason, it’s best to get code reviewed early on to leave plenty of time for changes. Consider using alternative code review methods like screensharing if it helps you get feedback earlier.

Be your own first code reviewer
Before you even make a commit, review all your code changes using git diff or your favorite compare tool. Usually, you can anticipate suggestions people will make and correct them early.

Give reviewers context to your changes
Give a good description of the changes and link to the relevant task in the issue tracker. Add enough comments to clarify gray areas in the code. Some code reviewers may be starting the code review with very little background in the area. Making comments inline in the code review can also help clarify.

Deal with code review comments head on
Code review comments can provoke negative feelings since they are critical of your work. Don’t take comments personally. Most developers just want help improve the quality of the code.

Handle comments immediately, defer and document suggestions as a last resort
If you’re already under pressure to ship code, added code review comments might cause you stress. I find it best to deal with comments immediately to relieve any stress they might cause. Don’t defer fixing any code review comments that can be resolved immediately. If you must defer any code review suggestions, document them in code comments or your issue tracker for follow up.

Acknowledge every comment before closing a review
Replying to a comment communicates to reviewers that you have received and resolved the comment by discussing, deferring, or handling the feedback. This shows reviewers you appreciate their comment and encourages them to participate in the future.

Reviewers, give reviewees context to your comments
As a code reviewer, it’s useful to mention if the comment is out of scope of the changes being reviewed or could be handled later on. This will help relieve some pressure from the reviewee to complete other code review suggestions.

At the end of the day, remember that code reviews are a team process about making better quality software.

About the Author

Object Partners profile.
Leave a Reply

Your email address will not be published.

Related Blog Posts
A security model for developers
Software security is more important than ever, but developing secure applications is more confusing than ever. TLS, mTLS, RBAC, SAML, OAUTH, OWASP, GDPR, SASL, RSA, JWT, cookie, attack vector, DDoS, firewall, VPN, security groups, exploit, […]
Building Better Data Visualization Experiences: Part 1 of 2
Through direct experience with data scientists, business analysts, lab technicians, as well as other UX professionals, I have found that we need a better understanding of the people who will be using our data visualization products in order to build them. Creating a product utilizing data with the goal of providing insight is fundamentally different from a typical user-centric web experience, although traditional UX process methods can help.
Kafka Schema Evolution With Java Spring Boot and Protobuf
In this blog I will be demonstrating Kafka schema evolution with Java, Spring Boot and Protobuf.  This app is for tutorial purposes, so there will be instances where a refactor could happen. I tried to […]
Redis Bitmaps: Storing state in small places
Redis is a popular open source in-memory data store that supports all kinds of abstract data structures. In this post and in an accompanying example Java project, I am going to explore two great use […]