Refactoring as one of the methods of agile development is part of our everyday practice. It consists in well-defined (often small) changes to the code without altering functionality. One goal is to make the code more clearly saying what it does. Refactoring in this sense is often done while exploring the code before its going to be changed. It shows once more the advantages of bottom up approaches, as small steps are less likely to break the code, while nevertheless in the long run not only leading to better local understandability but to better global structure.

Martin Fowlers “Refactoring: Improving the Design of Existing Code” from about 10 years ago is considered the canonical reference on the topic. And yet with this long history its fun to read, especially if one likes to know exactly whats going on inside those magic refactoring functions from our modern IDEs. All those refactoring methods are shown broken into small steps. By expressing them this way Fowler laid the groundwork for our today’s fancy refactoring tools.

The main part of the book consists of a list of “bad smells” – characteristics of code that call for refactoring (such as duplicated code, long methods, long parameter lists and so on) accompanied by the appropriate refactoring methods. The refactorings themselves are explained in a catalog, which is organized in 6 chapter of smaller refactorings and 1 chapter of bigger changes outlined less concrete then the other 6. A full catalogue can be found at Fowlers website

Apart from the catalog Fowler explains in detail why and when to refactor, the problems you can run into and the value of test suites for refactoring. The book is also well suited for people wanting to familiarize themselves with Java as a new language because it contains lots of manageable examples. Furthermore its always interesting to see different solutions to the same problem.

Email this Share this on Facebook Share this on LinkedIn Tweet This! RSS feed for comments on this post. TrackBack URL

Leave a comment