Refactoring_ Improving the Design of Existing Code 2nd Edition Martin Fowler All Chapters Instant Download
Refactoring_ Improving the Design of Existing Code 2nd Edition Martin Fowler All Chapters Instant Download
com
https://ebookmeta.com/product/refactoring_-improving-the-
design-of-existing-code-2nd-edition-martin-fowler/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookmeta.com/product/refactoring-improving-the-design-of-
existing-code-2nd-edition-martin-fowler/
ebookmeta.com
https://ebookmeta.com/product/2018-international-existing-building-
code-1st-edition-international-code-council/
ebookmeta.com
https://ebookmeta.com/product/ask-alice-1st-edition-kell-frillman/
ebookmeta.com
https://ebookmeta.com/product/foundations-of-celestial-mechanics-1st-
edition-elena-bannikova/
ebookmeta.com
https://ebookmeta.com/product/reason-in-the-service-of-faith-1st-
edition-paul-helm/
ebookmeta.com
https://ebookmeta.com/product/strictly-pleasure-1st-edition-carrie-
elks/
ebookmeta.com
https://ebookmeta.com/product/brighter-stars-special-edition-logan-
kelly/
ebookmeta.com
Louis I Kahn The Nordic Latitudes Fay Jones Collaborative
Series 1st Edition Per Olaf Fjeld
https://ebookmeta.com/product/louis-i-kahn-the-nordic-latitudes-fay-
jones-collaborative-series-1st-edition-per-olaf-fjeld/
ebookmeta.com
List of Refactorings
Change Function Declaration (124) Remove Flag Argument (314)
Change Reference to Value (252) Remove Middle Man (192)
Change Value to Reference (256) Remove Setting Method (331)
Collapse Hierarchy (380) Remove Subclass (369)
Combine Functions into Class (144) Rename Field (244)
Combine Functions into Transform Rename Variable (137)
(149) Replace Command with Function
Consolidate Conditional Expression (344)
(263) Replace Conditional with
Decompose Conditional (260) Polymorphism (272)
Encapsulate Collection (170) Replace Constructor with Factory
Encapsulate Record (162) Function (334)
Encapsulate Variable (132) Replace Derived Variable with Query
Extract Class (182) (248)
Extract Function (106) Replace Function with Command
Extract Superclass (375) (337)
Extract Variable (119) Replace Inline Code with Function
Hide Delegate (189) Call (222)
Inline Class (186) Replace Loop with Pipeline (231)
Inline Function (115) Replace Nested Conditional with
Inline Variable (123) Guard Clauses (266)
Introduce Assertion (302) Replace Parameter with Query (324)
Introduce Parameter Object (140) Replace Primitive with Object (174)
Introduce Special Case (289) Replace Query with Parameter (327)
Move Field (207) Replace Subclass with Delegate (381)
Move Function (198) Replace Superclass with Delegate
Move Statements into Function (213) (399)
Move Statements to Callers (217) Replace Temp with Query (178)
Parameterize Function (310) Replace Type Code with Subclasses
Preserve Whole Object (319) (362)
Pull Up Constructor Body (355) Separate Query from Modifier (306)
Pull Up Field (353) Slide Statements (223)
Pull Up Method (350) Split Loop (227)
Push Down Field (361) Split Phase (154)
Push Down Method (359) Split Variable (240)
Remove Dead Code (237) Substitute Algorithm (195)
Refactoring
Second Edition
Pearson Addison-Wesley
Signature Series
Second Edition
Martin Fowler
with contributions by Kent Beck
The author and publisher have taken care in the preparation of this book, but make no
expressed or implied warranty of any kind and assume no responsibility for errors or
omissions. No liability is assumed for incidental or consequential damages in connection
with or arising out of the use of the information or programs contained herein.
For information about buying this title in bulk quantities, or for special sales opportunities
(which may include electronic versions; custom cover designs; and content particular to
your business, training goals, marketing focus, or branding interests), please contact our
corporate sales department at corpsales@pearsoned.com or (800) 382–3419.
For questions about sales outside the U.S., please contact intlcs@pearson.com.
Cover photo: Waldo-Hancock Bridge & Penobscot Narrows Bridge by Martin Fowler
Lightbulb graphic: Irina Adamovich/Shutterstock
All rights reserved. Printed in the United States of America. This publication is protected
by copyright, and permission must be obtained from the publisher prior to any prohibited
reproduction, storage in a retrieval system, or transmission in any form or by any means,
electronic, mechanical, photocopying, recording, or likewise. For information regarding
permissions, request forms and the appropriate contacts within the Pearson Education
Global Rights & Permissions Department, please visit www.pearsoned.com/permissions/.
ISBN-13: 978-0-13-475759-9
ISBN-10: 0-13-475759-9
1 18
For Cindy
—Martin
This page intentionally left blank
Contents
vii
viii Contents
“Refactoring” was conceived in Smalltalk circles, but it wasn’t long before it found
its way into other programming language camps. Because refactoring is integral
to framework development, the term comes up quickly when “frameworkers” talk
about their craft. It comes up when they refine their class hierarchies and when
they rave about how many lines of code they were able to delete. Frameworkers
know that a framework won’t be right the first time around—it must evolve as
they gain experience. They also know that the code will be read and modified
more frequently than it will be written. The key to keeping code readable and
modifiable is refactoring—for frameworks, in particular, but also for software in
general.
So, what’s the problem? Simply this: Refactoring is risky. It requires changes
to working code that can introduce subtle bugs. Refactoring, if not done properly,
can set you back days, even weeks. And refactoring becomes riskier when prac-
ticed informally or ad hoc. You start digging in the code. Soon you discover new
opportunities for change, and you dig deeper. The more you dig, the more stuff
you turn up. . .and the more changes you make. Eventually you dig yourself into
a hole you can’t get out of. To avoid digging your own grave, refactoring must
be done systematically. When my coauthors and I wrote Design Patterns, we
mentioned that design patterns provide targets for refactorings. However, identi-
fying the target is only one part of the problem; transforming your code so that
you get there is another challenge.
Martin Fowler and the contributing authors make an invaluable contribution
to object-oriented software development by shedding light on the refactoring
process. This book explains the principles and best practices of refactoring, and
points out when and where you should start digging in your code to improve it.
At the book’s core is a comprehensive catalog of refactorings. Each refactoring
describes the motivation and mechanics of a proven code transformation. Some
of the refactorings, such as Extract Method or Move Field, may seem obvious.
But don’t be fooled. Understanding the mechanics of such refactorings is the
key to refactoring in a disciplined way. The refactorings in this book will help
you change your code one small step at a time, thus reducing the risks of evolving
xi
xii Foreword to the First Edition
your design. You will quickly add these refactorings and their names to your
development vocabulary.
My first experience with disciplined, “one step at a time” refactoring was when
I was pair-programming at 30,000 feet with Kent Beck. He made sure that we
applied refactorings from this book’s catalog one step at a time. I was amazed at
how well this practice worked. Not only did my confidence in the resulting code
increase, I also felt less stressed. I highly recommend you try these refactorings:
You and your code will feel much better for it.
xiii
Other documents randomly have
different content
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.