ACCU Home page ACCU Conference Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

Search in Book Reviews

The ACCU passes on review copies of computer books to its members for them to review. The result is a large, high quality collection of book reviews by programmers, for programmers. Currently there are 1949 reviews in the database and more every month.
Search is a simple string search in either book title or book author. The full text search is a search of the text of the review.
    View all alphabetically
Title:
Refactoring : Improving the Design of Existing Code
Author:
Martin Fowler and others
ISBN:
0 201 48567 2
Publisher:
Addison-Wesley
Pages:
431pp
Price:
£30-00
Reviewer:
Roger Orr
Subject:
process
Appeared in:
14-2
I had been looking forward to reading this book for some time - the first print run was sold out before I got a copy. Fortunately it has been reprinted, and the wait was worth it.

The book falls into three parts. The first few chapters describe what refactoring is, some of its principles and guidelines; the bulk of the book is an initial catalogue of refactorings; and the end of the book comprises various articles on refactoring written by a number of well-known experts.

So, what is refactoring? It is defined in the book as "a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behaviour". Unless you are a programmer who rigorously follows the 'waterfall' method of software development - and never works on version 2 of anything - I suspect a lot of your programming time is spent modifying existing code. If "the essence of training is to allow error without consequence" (Orson Scott Card) then this book provides great training as it will help you to modify code more safely. It is one of those books which, as I read it, kept describing things I do already - but with the advantages of giving then names, putting them into a context, providing a 'safety checklist' and making connections to other refactorings. All code is subject to 'software entropy' - by using the techniques in this book you can help to reverse this tendency! The technique of refactoring, by its nature, can be adopted progressively rather than by a single major shift in the way you program.

Refactoring is not substitute for experience - the chapter on recognising when to start (and when to stop!) refactoring is entitled 'Bad Smells in Code'. It gives a number of indications about code that might need refactoring, but the decision about whether, what and how much to refactor depends squarely upon your own judgement. After reading the book, however, your judgement should be better informed!

The middle section -the catalogue - gives a short summary of each refactoring, describes the motivation for doing it and provides some of the mechanics, and ends with a short worked example. The catalogue is designed as a reference section and provides solid starting point of good examples of refactoring rather than a definitive list of them all. Many of the catalogue entries refer to other refactorings which might be alternatives to consider. One of the things you will notice about the catalogue is that many of the refactorings are symmetric - for example 'Push Down Field' and then two pages on 'Pull Up Field'. I liked this recognition that there is no 'one best way' to write code under all circumstances and that software often involves a compromise between two conflicting goals. As time goes on the balance between the goals which gives the best solution for a given problem often changes - refactoring techniques help us to more safely change the balance of the compromise in working code.

The last section comprises a few chapters on refactoring written by a number of different authors about different aspects of the subject, and the range of authors provides a wider range of perspectives on it.

Finally, sandwiched between the references and the index is a "list of soundbites". This was a novel idea to me; however, I recommend collecting your own list of quotes as you read through the book, since you can select the ones particularly relevant to your programming style.

As Kent Beck provides some of the input you might guess that there is some use of the "extreme programming" methodology. However, although parts of the book are particularly relevant to this, the book as a whole is useful to a much wider audience than just XP advocates. Perhaps more crucially, the examples given are in Java and some do not 'translate' easily into C++, so if you are a C++ programmer you'll need to be aware of this.

C Vu describes itself as 'written by software developers for software developers' and this book certainly hits this mark. Recommended.