Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Refactoring
Fowler M., Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 1999. Type: Book (9780201485677)
Date Reviewed: Oct 23 2002

As most software developers know, software code has become more and more difficult to manage, and even to understand, as more features are added, bugs are fixed, and maintenance is done by different developers.

In many development projects, the money spent to maintain and extend code is more important than the funds dedicated to its development. This is because most developers write code that produces the right output for a given input, without paying attention to clean design and presentation.

Refactoring is about improving the internal structure of existing code without altering its external behavior. In practice, refactoring is a set of program transformations applied to a software system, in order to clean up code without introducing bugs.

This book builds on the foundations laid by the pioneers of refactoring, Ward Cunningham and Kent Beck. Fowler presents a detailed discussion of refactoring techniques and provides a catalog of 72 proven refactorings, with step-by-step instructions for applying each.

In chapter 1, the author presents an introductory example of refactoring. He performs a step-by-step improvement of a sample program by applying some of the techniques detailed in further chapters. In chapter 2, the author discusses cases that illustrate when refactoring existing code becomes a necessity. Chapter 3 contains a list of symptoms to identify badly written code, such as duplicated code, long methods, large classes, and data clumps. Chapter 4 demonstrates the use of JUnit, a testing framework built by Erich Gamma and Kent Beck to develop tests for code.

Chapter 5 presents the format for refactoring patterns. As with design patterns, refactorings are carefully defined using a standard format. This format specifies a name; a short summary describing the situation in which this refactoring is useful; the motivation for why the refactoring should be done and circumstances in which it shouldn’t be done; the mechanics (a step-by-step description of how to carry out the refactoring); and finally, an example that illustrates how this refactoring works.

Chapters 6 through 12 comprise an initial catalog of refactorings, categorized by their purpose. These categories include composing methods; moving features between objects; organizing data; simplifying conditional expressions; making method calls simpler; dealing with generalization; and big refactorings. Chapter 6 deals with the problem of long methods. Some refactorings are discussed that are used to package code properly. The core refactorings are Extract Method() and Inline Method(). Chapter 7 details the use of refactorings such as the Move Method(), Move Field(), and Extract Class(), used to redistribute responsibilities between objects. Chapter 8 discusses several refactorings that make working with data easier, and includes a set of illustrative examples. Chapter 9 presents the core refactorings used to simplify conditional expressions: Decompose Conditional, Consolidate Conditional Expression, and Replace Conditional with Polymorph ism. Chapter 10 presents refactorings to make method calls simpler: Rename Method, Add Parameter, Remove Parameter, and Parameterize Method.

Dealing with generalization is achieved by the mean of a set of refactorings. Chapter 11 contains the description of two of them. The Pull Up Field is applied when two subclasses have the same field. This refactoring is achieved by moving the field to the superclass. The Pull Up Method is applied when two methods have identical results on subclasses. This refactoring moves these methods to the superclass. Most of the research and practice of refactoring deals with smaller refactorings. Chapter 12 discusses big refactorings.

The final chapters are written by guest authors. Chapter 13 is by William Opdyke, who presents a brief discussion about the early experience he gained during his refactoring research, and who addresses other refactoring-related issues, such as software reuse, product evolution, and platform selection. This chapter ends with a set of resources and references for refactoring.

Manual refactoring is time consuming, and in most cases not very safe, since it can introduce bugs. Refactoring with an automated tool is thus very helpful. In chapter 14, Don Roberts and John Brant set up a list of technical requirements for a refactoring tool. In chapter 15, Kent Beck concludes the book by giving the reader guidelines for better use of refactoring.

This book is a classic reference for refactoring. The reader will notice, however, that to learn the effective use of refactoring, it is not sufficient to read the whole book, or even to learn the catalog of the seventy-two refactorings; practitioners must gain experience from intensive practice.

Reviewer:  Ghita Kouadri Review #: CR126558 (0301-0021)
Bookmark and Share
  Reviewer Selected
Featured Reviewer
 
 
Restructuring, Reverse Engineering, And Reengineering (D.2.7 ... )
 
 
Software Maintenance (K.6.3 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Restructuring, Reverse Engineering, And Reengineering": Date
Software evolution: the software maintenance challenge
Arthur L., Wiley-Interscience, New York, NY, 1988. Type: Book (9789780471628712)
Mar 1 1989
The year 2000 computing crisis
Murray J., Murray M., McGraw-Hill, Inc., New York, NY, 1996. Type: Book (9780079129451)
Oct 1 1996
Constraint-based design recovery for software reengineering
Woods S., Quilici A., Yang Q., Kluwer Academic Publishers, Norwell, MA, 1998. Type: Book (9780792380672)
Dec 1 1998
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy