Tool Support Finally Catches Up with Refactoring

Refactoring is an essential practice, but doing it by hand is slow and error-prone. For years, the only serious tool support came from the Smalltalk world, in the form of the Refactoring Browser. That tool proved the concept, but left Java developers working with manual techniques. That changed in January 2001, when two Java tools crossed the line from simple search-and-replace helpers to real refactoring support.

What Counts as a Real Refactoring Tool?

Not every tool that claims refactoring support actually delivers it. A common failure is the "Move Method" feature that shifts a method body to another class but leaves callers untouched, breaking compilation. That is not semantics-preserving, and it is not refactoring. Some tools do handle simpler transformations well, such as Rename Method and moving a class between packages, both of which are genuinely useful. But those operations only require shallow analysis.

To cross a threshold, a tool must be able to work with the program's parse tree, not just text patterns. The canonical test is Extract Method. This refactoring demands careful analysis of local variables and flow of control to determine which of them must become parameters or return values. It cannot be done with regular expressions. A tool that handles Extract Method likely has the infrastructure to support further refactorings.

Two Java Tools Cross the Line

The first to arrive was X-ref, a plug-in for emacs developed by Marian Vittek. It is a small operation and its extraction has some limitations, but it crossed the river. Java developers who live in emacs should take a look.

Shortly after, Instantiations shipped jFactor, a plug-in for IBM's Visual Age for Java. Instantiations has deep roots in Smalltalk, so it is no surprise the tool is built on a proper understanding of what refactoring requires. jFactor supports a solid set of refactorings, including Extract Method, which is invoked by selecting code, picking a menu item, and typing a name. It is polished and professional.

There is also IntelliJ's IDEA, an IDE that had already gained a following for its search capabilities. The team added renaming support, and in January extended the tool with Extract Method as well.

What Comes Next

The arrival of these tools is significant because refactoring has been mostly manual work for too long. The Refactoring Browser was a major leap forward for development tooling, and Java now has tooling that finally approaches that level. The January 2001 releases show that serious Extract Method support is achievable in a mainstream language. With that barrier crossed, it is reasonable to expect more refactorings to follow. Developers should try these tools and exercise their refactoring features.