The subtitle to Martin Fowler’s book on Refactoring is “Improving the Design of Existing Code”. That’s probably the most clear description of what refactoring is. It is a technique to restructure code in a disciplined way, and it is one of the most important principles of agile methods.
Fowler’s book catalogs a large number of ways that one can refactor code; he gives each of these refactoring mechanisms a name. For example, one form of refactoring is the “Pull Up” refactoring — it involves taking a method or field and moving it to a superclass.
Building on Fowler’s list of refactorings, tools like Eclipse implement easy support for refactoring, in many cases much more effectively than a simple cut and paste.
To read more about it, see the following:
- Refactoring Home Page
- Refactoring-Improving the Design of Existing Code (pdf) by Martin Fowler, as presented at JavaOne, 2000 Presentation
- Eclipse IDE