Wednesday, August 22, 2007

My New Favorite Refactoring Tool

Quite often I spy code that looks similar, but not obviously so[1]. I used to do a side by side comparison to help identify the similarities which would then allow me to refactor successfully. The problem is that a side by side comparison requires me to be very diligent, comparing each line one at a time.

Now I just use Notepad++ (but any text editor with tabs would do) and load suspected similar snippets in individual tabs. Then it is as simple as flipping between the tabs to see what moves. If things move, consolidate and continue. When they stop moving, I've found my refactoring.

[1] - we do use Simian, but it is on a large legacy code base, so the configuration for Simian isn't as tight as I would like it to be.

I wish I could ...

... blog as well/efficiently/profoundly as Jason Yip. For example...