Crossing the Rubicon. Again

Posted by Piers Cawley on Sep 9, 2006

In 2001, using an idea from James Duncan, who blames Damian Conway for getting him thinking on the right lines, I wrote a proof by implementation of the Extract Method refactoring for Perl. Though I say so myself, this was a Big Deal - Martin Fowler calls Extract Method the Refactoring Rubicon - once you have a tool to help you do that refactoring automatically, you can probably implement the rest of the Smalltalk Refactoring Browser and free yourself to think more about the interesting aspects of programming.

And nothing happened.

Five years later, I mentioned this to Jesse Vincent at EuroOSCON. He got that “You interest me strangely” look. I headed off to another session and left Jesse to scratch his itch.

About 3 hours later, we hooked up again, and he showed me the vi plugin he’s hacked up which implements an ‘extract function’ refactoring. So we sat down together and made it extract a method correctly.

At this point, magic happened. Jesse’s original script was, putting it politely, very hacky. It’s less hacky now, in part because it’s been refactored with the assistance of this cool new tool he’d just written to extract methods from Perl code.