Code review is a subject with which I’m quite familiar. I’m familiar first as a participant, both reviewing and being reviewed, but it goes deeper than that. As an IT management consultant, I’ve advised on instituting and refining such processes and I actually write for SmartBear, whose products include Collaborator, a code review tool. In spite of this, however, I’ve never written much about the intersection between NDepend and code review. But I’d like to do so today.
I suppose it’s the nature of my own work that has made this topic less than foremost on my mind. Over the last couple of years, I’ve done a lot of lone wolf, consultative code assessments for clients. In essence, I take a codebase and its version history and use NDepend and other tools to perform an extensive analysis. I also quietly apply some of the same practices to my own code that I use for example purposes. But neither of these is collaborative because it’s been a while since I logged a lot of time in a collaborative delivery team environment.
But my situation being somewhat out of sync with industry norms does not, in any way, alter industry norms. And the norm is that software development is generally a highly collaborative affair, and that most code review is happening in highly collaborative environments. And NDepend is not just a way for lone wolves or pedants to do deep dives on code. It really shines in the group setting.
NDepend Can Automate the Easy Stuff out of Code Review
When discussing code review, I’m often tempted to leave “automate what you can” for the end, since it’s a powerful point. But, on the other hand, I also think it’s perhaps the first thing that you should go and do right out of the gate, so I’ll mention it here. After all, automating the easily-automated frees humans up to focus on things that require human intervention.
It’s pretty likely that you have some kind of automation in process for enforcing coding standards. And, if you don’t, get some in place. You should not be wasting time at code review with, “you didn’t put an underscore in front of that field.” That’s the sort of thing that a machine can easily figure out, and that many, many plugins will figure out for you.
The advantages here are many, but two quick ones bear mentioning here. First is the time-savings that I’ve discussed, and second is the tightening of the feedback loop. If a developer writes a line of code, forgetting that underscore, the code review may not happen for a week or more. If there’s a tool in place creating warnings, preventing a commit, or generating a failed build, the feedback loop is much tighter between undesirable code and undesirable outcome. This makes improvement more rapid, and it makes the source of the feedback an impartial machine instead of a (perceived) judgmental coworker.
Continue reading Improve Your Code Review Game with NDepend