Avi Das

Home for my code, thoughts and else.

Frame Code Reviews as Gift Exchanges

The best metaphor I have found for thinking about code reviews is a gift exchange. The terms pull request and code reviews will be used interchangeably in this post.

The balance of writing code vs everything else that is necessary to be a successful member of a software team is one of the key challenges of our job.

Code reviews are an interesting mix. You have to understand someone else’s point of view, their journey through solving a problem in form of code. Or you have to face up to what everyone else thinks about code that you worked hard to write. Those reviews stand in your way of getting your code up to users and getting the emotional payoff from releasing something. The engagement or catharsis from building software is not an available reward when you are in code review mode.

Moreover, a code review must take into consideration not just the code, but the project, team and the company into consideration.

These qualities make code review a great opportunity to practice interpersonal skills alongside your programming skills. The best engineers I have worked with take code reviews and responding to feedback on their own pull requests very seriously. Specific strategies that engineers use are different. Some review pull requests first time in the day, others end of the day or anything in between.

Framing is a powerful technique we can use when summoning the energy to do code review everyday. It would be to see every request for a code review or feedback you receive on code review as a gift. Someone values your intelligence enough to ask for your review or taking their valuable time to give you feedback that can only improve you as an engineer. Everyday, you receive these gifts. But you can also offer them to others, which in itself is a meaningful and satisfying act.

Viewing pull requests this way makes them less of a transaction, and illustrates code reviews as a win-win game. So next time you are opening up a pull request, think how you can make it easier for someone else to review. Can you link to the ticket, provide a screenshot/gif, added sufficient comments and followed good coding practices? Have you considered breaking your change into smaller chunks? Can you sit down with a reviewer and go over the changes in code?

Let’s make it easier for someone else to offer us this gift.

Comments