Refactoring: Improving The Design Of Existing Code

Kobo eBook available

read instantly on your Kobo or tablet.

buy the ebook now

Refactoring: Improving The Design Of Existing Code

by John Brant, Kent Beck, Martin Fowler

Pearson Education | September 20, 1999 | Hardcover

4 out of 5 rating. 1 Reviews
Now you can dramatically improve the design, performance, and manageability of object-oriented code without altering its interfaces or behavior. Refactoring shows you exactly how to spot the best opportunities for refactoring and exactly how to do it -- step by step. Through more than forty detailed case studies, you''ll learn powerful -- and surprisingly simple -- ways to redesign code that is already in production. You''ll learn scores of specific techniques, including when to move fields between classes, when to move code or down its hierarchy, and when to divide a single method into up two. Through intuition and trial and error, master programmers have spent years evolving these techniques; this book brings them all together into a comprehensive guide that any experienced developer can use.

Format: Hardcover

Dimensions: 464 Pages, 7.48 × 9.45 × 1.18 in

Published: September 20, 1999

Publisher: Pearson Education

Language: English

The following ISBNs are associated with this title:

ISBN - 10: 0201485672

ISBN - 13: 9780201485677

Found in: Software Development

save
5%

In Stock

$67.99

Online Price

or, Used from $31.75

eGift this item

Give this item in the form of an eGift Card.

+ what is this?

This item is eligible for FREE SHIPPING on orders over $25.
See details

Easy, FREE returns. See details

All available formats:

Check store inventory (prices may vary)

Reviews

– More About This Product –

Refactoring: Improving The Design Of Existing Code

Refactoring: Improving The Design Of Existing Code

by John Brant, Kent Beck, Martin Fowler

Format: Hardcover

Dimensions: 464 Pages, 7.48 × 9.45 × 1.18 in

Published: September 20, 1999

Publisher: Pearson Education

Language: English

The following ISBNs are associated with this title:

ISBN - 10: 0201485672

ISBN - 13: 9780201485677

Read from the Book

Once upon a time, a consultant made a visit to a development project. The consultant looked at some of the code that had been written; there was a class hierarchy at the center of the system. As he wandered through the hierarchy, the consultant saw that it was rather messy. The higher-level classes made certain assumptions about how the classes would work, assumptions that were embodied in inherited code. That code didn''t suit all the subclasses, however, and was overridden quite heavily. If the superclass had been modified a little, then much less overriding would have been necessary. In other places some of the intention of the superclass had not been properly understood, and behavior present in the superclass was duplicated. In yet other places several subclasses did the same thing with code that could clearly be moved up the hierarchy. The consultant recommended to the project management that the code be looked at and cleaned up, but the project management didn''t seem enthusiastic. The code seemed to work and there were considerable schedule pressures. The managers said they would get around to it at some later point. The consultant had also shown the programmers who had worked on the hierarchy what was going on. The programmers were keen and saw the problem. They knew that it wasn''t really their fault; sometimes a new pair of eyes are needed to spot the problem. So the programmers spent a day or two cleaning up the hierarchy. When they were finished, the programmers h
read more read less

Table of Contents

1. Refactoring, a First Example. The Starting Point. The First Step in Refactoring. Decomposing and Redistributing the Statement Method. Replacing the Conditional Logic on Price Code with Polymorphism. Final Thoughts. 2. Principles in Refactoring. Defining Refactoring. Why Should You Refactor? When Should You Refactor? What Do I Tell My Manager? Problems with Refactoring. Refactoring and Design. Refactoring and Performance. Where Did Refactoring Come From? 3. Bad Smells in Code. Duplicated Code. Long Method. Large Class. Long Parameter List. Divergent Change. Shotgun Surgery. Feature Envy. Data Clumps. Primitive Obsession. Switch Statements. Parallel Inheritance Hierarchies. Lazy Class. Speculative Generality. Temporary Field. Message Chains. Middle Man. Inappropriate Intimacy. Alternative Classes with Different Interfaces. Incomplete Library Class. Data Class. Refused Bequest. Comments. 4. Building Tests. The Value of Self-testing Code. The JUnit Testing Framework. Adding More Tests. 5. Toward a Catalog of Refactorings. Format of the Refactorings. Finding References. How Mature Are These Refactorings? 6. Composing Methods. Extract Method. Inline Method. Inline Temp. Replace Temp with Query. Introduce Explaining Variable. Split Temporary Variable. Remove Assignments to Parameters. Replace Method with Method Object. Substitute Algorithm. 7. Moving Features Between Objects. Move Method. Move Field. Extract Class. Inline Class. Hide Delegate. Remove Middle Man. Introduce Foreign
read more read less

From the Publisher

Now you can dramatically improve the design, performance, and manageability of object-oriented code without altering its interfaces or behavior. Refactoring shows you exactly how to spot the best opportunities for refactoring and exactly how to do it -- step by step. Through more than forty detailed case studies, you''ll learn powerful -- and surprisingly simple -- ways to redesign code that is already in production. You''ll learn scores of specific techniques, including when to move fields between classes, when to move code or down its hierarchy, and when to divide a single method into up two. Through intuition and trial and error, master programmers have spent years evolving these techniques; this book brings them all together into a comprehensive guide that any experienced developer can use.

From the Jacket

As the application of object technology--particularly the Java programming language--has become commonplace, a new problem has emerged to confront the software development community. Significant numbers of poorly designed programs have been created by less-experienced developers, resulting in applications that are inefficient and hard to maintain and extend. Increasingly, software system professionals are discovering just how difficult it is to work with these inherited, "non-optimal" applications. For several years, expert-level object programmers have employed a growing collection of techniques to improve the structural integrity and performance of such existing software programs. Referred to as "refactoring," these practices have remained in the domain of experts because no attempt has been made to transcribe the lore into a form that all developers could use. . .until now. In Refactoring: Improving the Design of Existing Code, renowned object technology mentor Martin Fowler breaks new ground, demystifying these master practices and demonstrating how software practitioners can realize the significant benefits of this new process.

 

With proper training a skilled system designer can take a bad design and rework it into well-designed, robust code. In this book, Martin Fowler shows you where opportunities for refactoring typically can be found, and how to go about reworking a bad design into a good one. Each refactoring step is simple--seemingly too simple to be worth doing. Refactoring may involve moving a field from one class to another, or pulling some code out of a method to turn it into its own method, or even pushing some code up or down a hierarchy. While these individual steps may seem elementary, the cumulative effect of such small changes can radically improve the design. Refactoring is a proven way to prevent software decay.

 

In addition to discussing the various techniques of refactoring, the author provides a detailed catalog of more than seventy proven refactorings with helpful pointers that teach you when to apply them; step-by-step instructions for applying each refactoring; and an example illustrating how the refactoring works. The illustrative examples are written in Java, but the ideas are applicable to any object-oriented programming language.

About the Author

Martin Fowler is the Chief Scientist of ThoughtWorks, an enterprise-application development and delivery company. He''s been applying object-oriented techniques to enterprise software development for over a decade. He is notorious for his work on patterns, the UML, refactoring, and agile methods. Martin lives in Melrose, Massachusetts, with his wife, Cindy, and a very strange cat. His homepage is http://martinfowler.com.

Kent Beck consistently challenges software engineering dogma, promoting ideas like patterns, test-driven development, and Extreme Programming. Currently affiliated with Three Rivers Institute and Agitar Software, he is the author of many Addison-Wesley titles.

John Brant and Don Roberts are the authors of the Refactoring Browser for Smalltalk, which is found at http://st-www.cs.uiuc.edu/~brant/RefactoringBrowser/. They are also consultants who have studied both the practical and theoretical aspects of refactoring for six years.

William Opdyke''s doctoral research on refactoring object-oriented frameworks at the University of Illinois led to the first major publication on this topic. He is currently a Distinguished Member of Technical Staff at Lucent Technologies/Bell Laboratories.

John Brant and Don Roberts are the authors of the Refactoring Browser for Smalltalk, which is found at http://st-www.cs.uiuc.edu/~brant/RefactoringBrowser/. They are also consultants who have studied both the practical and theoretical aspects of refactoring for six years.





From the Author

Once upon a time, a consultant made a visit to a development project. The consultant looked at some of the code that had been written; there was a class hierarchy at the center of the system. As he wandered through the hierarchy, the consultant saw that it was rather messy. The higherlevel classes made certain assumptions about how the classes would work, assumptions that were embodied in inherited code. That code didn’t suit all the subclasses, however, and was overridden quite heavily. If the superclass had been modified a little, then much less overriding would have been necessary. In other places some of the intention of the superclass had not been properly understood, and behavior present in the superclass was duplicated. In yet other places several subclasses did the same thing with code that could clearly be moved up the hierarchy. The consultant recommended to the project management that the code be looked at and cleaned up, but the project management didn’t seem enthusiastic. The code seemed to work and there were considerable schedule pressures. The managers said they would get around to it at some later point. The consultant had also shown the programmers who had worked on the hierarchy what was going on. The programmers were keen and saw the problem. They knew that it wasn’t really their fault; sometimes a new pair of eyes are needed to spot the problem. So the programmers spent a day or two cleaning up the hierarchy. When they were finished, the programmers had r
read more read less
Item not added

This item is not available to order at this time.

See used copies from 00.00
  • My Gift List
  • My Wish List
  • Shopping Cart