Thursday, February 21, 2013

Code Review Best Practices - Use Code Review Software

Although you can get by doing live code reviews, I've found that using code review software has generally made my code reviews much more productive. There aren't a ton of code review software packages out there, but some of them are outstanding.

If you're not familiar with them, you can connect them to your version control repository, and then load in change sets. Once you've started a review on a change set, you and your team can carry on a forum-style conversation, right there in the middle of your code, without affecting the actual source code files.

Here's why I think it's made such a difference for me.

Understanding the Context

One of the challenges with live walkthroughs is that you don't get as much of a chance to explore the code. Sure, you get to look over the diff with someone, perhaps looking over their shoulder at their monitor. Or maybe you printed the code out on paper. But you're mostly limiting your examination to the change set itself.

But when you use code review software, reviewers have a chance to read and more fully understand the code. Since they're reviewing the code at their desk, on their time, they can take time to open related classes and understand all of the interactions.

Filtering Your Comments

Another challenge with live walkthroughs is that many people feel uncomfortable with silence. I find I've got a mental stopwatch that makes me feel like I've gotta say something after just 2 or 3 seconds of silence. When that happens, sometimes what comes out of my mouth doesn't sound nearly as cool as the way it sounded in my mind. And sometimes, it can even come off the wrong way.

The good thing about using code review software is that it gives me a chance to give my thoughts an extra pass before I commit to them. When I type my thoughts into a text box, I get to apply an extra mental filter to them before I hit the submit button. And sometimes that can make the difference between insulting someone and building them up!

Archiving Your Discussion

Have you ever forgotten decisions that were made in a meeting? Maybe a week or two goes by, and everyone recalls a different outcome. Or maybe you remember the outcome, but not the reason for the decision. This can happen often with live code reviews, also.

Code review software can help with this, too! All of your discussion around a chunk of code will be archived in such a way that you can pull it up weeks, months, or even years later! Some packages also allow you to summarize the review before you close it out, which can also provide helpful context when you revisit the code in the future.

It won't solve all of your problems, and you'll still have to meet up in person to talk about things that you couldn't hammer out online. But overall, I've found that software can really make code reviews go smoother. If you're still doing them live, give code review software a shot! You'll get spoiled quickly!

No comments:

Post a Comment

Profile Picture
Dave Leeds
My Hobbies:
  • Programming
  • Cartooning
  • Music Writing
Full Profile