Photo by Annie Spratt on Unsplash
Photo by Annie Spratt on Unsplash

I personally love code reviews

Now, I understand that lots of devs don’t like doing them. There’s always those devs who groan or drag their feet to get a code review out to the team. The code review is late, or they ‘forgot’ to do it. Their response to every criticism or correction on the review is irritation or grudging admission to make changes. Whatever the way by which some devs dodge doing the review, there are plenty of devs who just don’t want to do them.

The thing is, code reviews make us better devs. I know that sounds trite, but it’s true. Having others look at our work is a way of ensure that those little mistakes we missed, those design standards we violated are caught. No matter how long we’ve been writing code, or how great and brilliant we are in our own minds, there’s always room for improvement. Who knows. You might actually just learn something. Having our teammates look over our work through code reviews is a great way to ensure we are keeping our codebase healthy.

With that said…

Like I said, I love code reviews, but let’s be honest. Code reviews do feel a little late in the game. I mean, if I write a bunch of code, and now kick it over the fence to my teammates, I’ve just done a gaggle of work which in most cases is coming at them firsthand. Sure, if I make a very small change, like a line or two, then the chances that there will be a lot of changes coming out of the review is small. If I’ve kept my reviewers up to snuff on my work in progress, again, low potential for changes.

But honestly, how often does this happen? Fact is, more often than not, the changes I’m putting out in a review are far larger than a couple lines, and more than likely, my teammates haven’t seen what I’ve been up to for a day, a couple days, or even a week.

And this leads to waste. Not to get all Kanban about it, but this way of working means time wasted on my part because I’ve written a lot of code that now needs to be fixed or adjusted. It means time wasted on the part of my teammates because they are seeing my code for the first time, and now have to go over it with no context and no idea what I’ve been doing all this time. They are helping me to correct mistakes which they could have caught earlier in the game.

Code reviews are a band-aid to a bigger problem

A code review is a means of allowing my teammates to check my work, to make sure I’ve done my best to protect the health and integrity of the codebase. But the code review comes too late in the game. Wouldn’t it be much better if I could get regular feedback as I work? Wouldn’t it make more sense to let my teammates keep up to date with my work as I’m doing the work?

Code reviews are a great way to keep our codebase clean, and to keep our teammates up to snuff with what we’re doing. Where code reviews fail is that it takes place too late in the process. Wouldn’t it be better if we could get our code reviewed as we were writing it?

Yeah, it really would.