REFACTORING: >From "Refactoring: Improving the Design of Existing Code," , Martin Fowler , Addison-Wesley, 1999, p. xvi What Is Refactoring? Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written. "Improving the design after it has been written." That's an odd turn of phrase. In our current understanding of software development we believe that we design and then we code. A good design comes first, and the coding comes second. Over time the code will be modified, and the integrity of the system, its structure according to that design, gradually fades. The code slowly sinks from engineering to hacking. Refactoring is the opposite of this practice. With refactoring you can take a bad design, chaos even, and rework it into well-designed code. Each step is simple, even simplistic. You move a field from one class to another, pull some code out of a method to make into its own method, and push some code up or down a hierarchy. Yet the cumulative effect of these small changes can radically improve the design. It is the exact reverse of the normal notion of software decay. With refactoring you find the balance of work changes. You find that design, rather than occurring all up front, occurs continuously during development. You learn from building the system how to improve the design. The resulting interaction leads to a program with a design that stays good as development continues ------------------------------------------------------------------- There are excellent online resources on Refactoring. So I will simply quote them here. ;) (reuse) ;) http://www.refactoring.com/ - The official web site of refactoring. It contains a summary of the book, and a concise writeup on the refactoprings given in the book: http://www.refactoring.com/catalog/index.html for the catalog of refactorings. Some refactoring browsers are available, or in the making. You will find links to them. Refactoring makes a very good project for people interested in programming languages/ compilers. Some other links are: http://www.volantec.biz/refactoring.htm http://www.cs.unc.edu/~stotts/COMP204/refactor/