Thursday, December 18, 2008

Rapid Refactoring

Lately I've noticed that I'm implementing features in about 1/6 of the time I would have estimated that it would take me. Our application is in a mature stage; these new features are about 50% new code and 50% refactoring of existing code.

I'm trying to figure out how things are getting done faster. And I have a few ideas:

Bookmarks. They're part of the standard Text Editor Toolbar in Visual Studio. The first thing I do when I'm about to implement something is clear all my existing bookmarks, then bookmark the places where I'll be adding or changing code.

Tracepoints. The second thing I do when I'm about to implement something is to clear all my Breakpoints, which also clears the Tracepoints. As I'm debugging, I'll add Tracepoints to my code to output relevant values.

The #1 advantage that Tracepoints have over Debug.Writeline is that you're not modifying your code. It's easy to turn them on, easy to disable them, and your chances of typos affecting a build are minimal.

The Immediate Window. I used to be a big fan of the Quick Watch window, but lately the Immediate Window has been my go-to place for rapid interrogation and evaluation. Those few clicks I save by not expanding properties seem to add up.