Reviewing the Code Review, Part I

Claudio PinkusClaudio Pinkus
August 7, 2019

Some of our customers are telling us that they are using CodeStream to shorten code reviews by as much as 50%.  It’s a lightweight approach, and we are trying to learn from their experience and feedback, and improve on the processes and features we offer to make those code reviews even better. CodeStream introduces the concept of a continuous code review, a light-weight, in-editor process that enables the review of any part of your codebase, at any time. Making code review continuous means you can get feedback earlier in the process as you are stubbing out functions and classes, during heavy development while you are building a new feature, immediately prior to merge as you seek feedback from your team, and importantly even for code that was merged some time ago, as you come across technical debt in your codebase. 

What’s wrong with code reviews?

According to Traci Lum in her article How to Give and Get Better Code Reviews, code reviews are among the most dreaded activities by developers.  Developers, who typically spend much time creating, imagining, and inventing (often on their own and without interference), face an uncreative procedural judgment. She writes: “...it’s a time when you, the developer, the craftsman, the artist, present your work before a council of critics and beg them to bless your masterpiece with a thumbs-up emoji and a “LGTM.””.

Code reviews are, of course, necessary to maintain code quality.  Why such dread?  What can be done to reduce it significantly? What are the benefits of a different approach? Much of what’s wrong with code reviews boils down to three elements: 

  1. the time elapsed between code being written and code being reviewed, 
  2. the context switching imposed by the very process, away from the code and into the browser or to a different context outside your IDE, and finally 
  3. the fact that a typical review looks at any given code only once – it’s being readied for deployment – and does not contemplate a continuous improvement process.  

In this context, let’s discuss some of the suggestions provided by Traci on how to improve the code review process, and suggest improvements to the improvements

Developers generally live in their IDE.  That is the place where code is written, changed, compared, etc.  The reason why code reviews are not performed in your IDE is an accident of timing.  Had IDEs been more extensible earlier, we would have seen all the benefits of performing code reviews in context and the disjointed nature of the process might have been avoided.

Your IDE is the best place to discuss code

Traci Lum’s suggestions are helpful and reasonable and they are centered on improving the PR process. Let’s summarize her recommendation while addressing potential improvements that could be made if the code review was started earlier and originated in your IDE instead of a PR.

If you want to get better code reviews, her suggestions include:

A. Linking to the GitHub issue or JIRA ticket from the body of a PR

  • What if there was no PR and you could instead generate or attach a Jira ticket or GitHub issue to the code itself from your IDE, assign someone to fix or review,  and have that link be permanent and visible to any teammate perusing the code?

B. Writing a quick summary or list of the changes, trade-offs, and remaining todos

  • What if the summary of the changes was just an automatic report being generated within your IDE including all the questions and concerns?

C. Tagging pull requests with labels

D. Review your own code before you officially put it up for review

  • For C and D, what if you could tag and comment on any code block and make that easily accessible in editor for all the devs in your team?

E. Annotate places where you’re especially unsure or want feedback

  • What if you could just do that at any time as you write code, even before a PR, so that the feedback can help you avoid a dead end, thus reducing errors and technical debt?

F. Tag the right people

  • What if once you select any code block in your IDE there was an instantaneous git blame lookup to let you know who wrote or edited that code and that person was @mentioned in your composition box automatically?

G. Take a breath and internalize the reviews

  • Always good advice. What if the whole conversation was saved and accessible to both parties (and ultimately to any dev on the team) as useful documentation that explains how decisions were made?

If you want to give better code reviews, her suggestions are:

H. Ask questions instead of making statements, that is, fewer WTFs

  • what if you could share a code example to illustrate a solution and it was linked to the review automatically?

I. Articulate the problems (if any) and suggest alternatives

J. Try to understand the context and the proposed solution

K. Highlight wins, by which she means, be positive when giving feedback

If the PR is to remain the primary place where a code review takes place, all of the steps suggested by Traci in order to improve the process would be fine.  However, if we are prepared to consider beginning the review process earlier, prior to a PR, unencumbered by the PR, the code review becomes continuous, that is, at any time, on any line of code, about any issue.

In Part 2, we will explore other suggestions for improving the code review, and offer ideas on how to make things even easier, more productive, and more pleasant.


Discuss

Please share your thoughts and feedback @teamcodestream.

About CodeStream

CodeStream helps development teams discuss, review and understand code. CodeStream links comments and issues directly to the code blocks they refer to, making them instantly available to everyone on the team.  

Thank you for your interest in CodeStream.

We'll be in touch shortly.
Oops! Something went wrong while submitting the form.
Recent Blog Posts

Try it for free.
Pay if you love it.

Your team knows a lot about your code but the knowledge is locked inside the heads of individual developers.

CodeStream helps to capture and share that knowledge, making your team happier, more productive and more resilient.


Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Thank you for your interest in CodeStream.

We'll be in touch shortly.
Oops! Something went wrong while submitting the form.