gogogo
Syndetics cover image
Image from Syndetics

Refactoring to patterns

By: Material type: TextTextSeries: The Addison-Wesley signature series | A Martin Fowler signature bookPublication details: Boston [u.a.] Addison-Wesley 2007Edition: 6. printDescription: XXVI, 367 S. graph. DarstISBN:
  • 9780321213358
  • 0321213351
Subject(s):
Holdings
Item type Current library Call number Copy number Status Date due Barcode
Standard Loan Thurles Library Main Collection 005.16 KER (Browse shelf(Opens below)) 1 Available R13358KRCT
Standard Loan Thurles Library Main Collection 005.16 KER (Browse shelf(Opens below)) 1 Available R13350KRCT
Standard Loan Thurles Library Main Collection 005.16 KER (Browse shelf(Opens below)) 1 Available R13355KRCT
Standard Loan Thurles Library Main Collection 005.16 KER (Browse shelf(Opens below)) 1 Available R13352KRCT

Enhanced descriptions from Syndetics:

In 1994, Design Patterns changed the landscape of object-oriented development by introducing classic solutions to recurring design problems. In 1999, Refactoring revolutionized design by introducing an effective process for improving code. With the highly anticipated Refactoring to Patterns , Joshua Kerievsky has changed our approach to design by forever uniting patterns with the evolutionary process of refactoring.

This book introduces the theory and practice of pattern-directed refactorings: sequences of low-level refactorings that allow designers to safely move designs to, towards, or away from pattern implementations. Using code from real-world projects, Kerievsky documents the thinking and steps underlying over two dozen pattern-based design transformations. Along the way he offers insights into pattern differences and how to implement patterns in the simplest possible ways.

Coverage includes:

A catalog of twenty-seven pattern-directed refactorings, featuring real-world code examples Descriptions of twelve design smells that indicate the need for this book's refactorings General information and new insights about patterns and refactoring Detailed implementation mechanics: how low-level refactorings are combined to implement high-level patterns Multiple ways to implement the same pattern--and when to use each Practical ways to get started even if you have little experience with patterns or refactoring

Refactoring to Patterns reflects three years of refinement and the insights of more than sixty software engineering thought leaders in the global patterns, refactoring, and agile development communities. Whether you're focused on legacy or "greenfield" development, this book will make you a better software designer by helping you learn how to make important design changes safely and effectively.



Literaturverz. S. 351 - 353

Table of contents provided by Syndetics

  • Foreword (p. xv)
  • Foreword (p. xvii)
  • Preface (p. xix)
  • What Is This Book About? (p. xix)
  • What Are the Goals of This Book? (p. xix)
  • Who Should Read This Book? (p. xx)
  • What Background Do You Need? (p. xx)
  • How to Use This Book (p. xxi)
  • The History of This Book (p. xxii)
  • Standing on the Shoulders of Giants (p. xxiii)
  • Acknowledgments (p. xxiii)
  • Chapter 1 Why I Wrote This Book (p. 1)
  • Over-Engineering (p. 1)
  • The Patterns Panacea (p. 2)
  • Under-Engineering (p. 3)
  • Test-Driven Development and Continuous Refactoring (p. 4)
  • Refactoring and Patterns (p. 6)
  • Evolutionary Design (p. 8)
  • Chapter 2 Refactoring (p. 9)
  • What Is Refactoring? (p. 9)
  • What Motivates Us to Refactor? (p. 10)
  • Many Eyes (p. 11)
  • Human-Readable Code (p. 12)
  • Keeping It Clean (p. 13)
  • Small Steps (p. 14)
  • Design Debt (p. 15)
  • Evolving a New Architecture (p. 16)
  • Composite and Test-Driven Refactorings (p. 17)
  • The Benefits of Composite Refactorings (p. 19)
  • Refactoring Tools (p. 20)
  • Chapter 3 Patterns (p. 23)
  • What Is a Pattern? (p. 23)
  • Patterns Happy (p. 24)
  • There Are Many Ways to Implement a Pattern (p. 26)
  • Refactoring to, towards, and away from Patterns (p. 29)
  • Do Patterns Make Code More Complex? (p. 31)
  • Pattern Knowledge (p. 32)
  • Up-Front Design with Patterns (p. 33)
  • Chapter 4 Code Smells (p. 37)
  • Duplicated Code (p. 39)
  • Long Method (p. 40)
  • Conditional Complexity (p. 41)
  • Primitive Obsession (p. 41)
  • Indecent Exposure (p. 42)
  • Solution Sprawl (p. 43)
  • Alternative Classes with Different Interfaces (p. 43)
  • Lazy Class (p. 43)
  • Large Class (p. 44)
  • Switch Statements (p. 44)
  • Combinatorial Explosion (p. 45)
  • Oddball Solution (p. 45)
  • Chapter 5 A Catalog of Refactorings to Patterns (p. 47)
  • Format of the Refactorings (p. 47)
  • Projects Referenced in This Catalog (p. 49)
  • XML Builders (p. 50)
  • HTML Parser (p. 50)
  • Loan Risk Calculator (p. 51)
  • A Starting Point (p. 51)
  • A Study Sequence (p. 52)
  • Chapter 6 Creation (p. 55)
  • Replace Constructors with Creation Methods (p. 57)
  • Motivation (p. 57)
  • Mechanics (p. 60)
  • Example (p. 60)
  • Variations (p. 65)
  • Move Creation Knowledge to Factory (p. 68)
  • Motivation (p. 69)
  • Mechanics (p. 72)
  • Example (p. 73)
  • Encapsulate Classes with Factory (p. 80)
  • Motivation (p. 81)
  • Mechanics (p. 82)
  • Example (p. 83)
  • Variations (p. 86)
  • Introduce Polymorphic Creation with Factory Method (p. 88)
  • Motivation (p. 89)
  • Mechanics (p. 90)
  • Example (p. 92)
  • Encapsulate Composite with Builder (p. 96)
  • Mechanics (p. 99)
  • Example (p. 100)
  • Variations (p. 111)
  • Inline Singleton (p. 114)
  • Motivation (p. 115)
  • Mechanics (p. 117)
  • Example (p. 118)
  • Chapter 7 Simplification (p. 121)
  • Compose Method (p. 123)
  • Motivation (p. 123)
  • Mechanics (p. 125)
  • Example (p. 126)
  • Replace Conditional Logic with Strategy (p. 129)
  • Motivation (p. 130)
  • Mechanics (p. 131)
  • Example (p. 133)
  • Move Embellishment to Decorator (p. 144)
  • Motivation (p. 144)
  • Mechanics (p. 148)
  • Example (p. 150)
  • Replace State-Altering Conditionals with State (p. 166)
  • Motivation (p. 167)
  • Mechanics (p. 168)
  • Example (p. 169)
  • Replace Implicit Tree with Composite (p. 178)
  • Motivation (p. 179)
  • Mechanics (p. 181)
  • Example (p. 183)
  • Replace Conditional Dispatcher with Command (p. 191)
  • Motivation (p. 192)
  • Mechanics (p. 193)
  • Example (p. 195)
  • Chapter 8 Generalization (p. 203)
  • Form Template Method (p. 205)
  • Motivation (p. 206)
  • Mechanics (p. 207)
  • Example (p. 208)
  • Extract Composite (p. 214)
  • Motivation (p. 215)
  • Mechanics (p. 215)
  • Example (p. 216)
  • Replace One/Many Distinctions with Composite (p. 224)
  • Motivation (p. 225)
  • Mechanics (p. 227)
  • Example (p. 228)
  • Replace Hard-Coded Notifications with Observer (p. 236)
  • Motivation (p. 236)
  • Mechanics (p. 238)
  • Example (p. 239)
  • Unify Interfaces with Adapter (p. 247)
  • Motivation (p. 248)
  • Mechanics (p. 249)
  • Example (p. 250)
  • Extract Adapter (p. 258)
  • Motivation (p. 259)
  • Mechanics (p. 261)
  • Example (p. 261)
  • Variations (p. 268)
  • Replace Implicit Language with Interpreter (p. 269)
  • Motivation (p. 270)
  • Mechanics (p. 272)
  • Example (p. 273)
  • Chapter 9 Protection (p. 285)
  • Replace Type Code with Class (p. 286)
  • Motivation (p. 287)
  • Mechanics (p. 288)
  • Example (p. 290)
  • Limit Instantiation with Singleton (p. 296)
  • Motivation (p. 296)
  • Mechanics (p. 297)
  • Example (p. 298)
  • Introduce Null Object (p. 301)
  • Motivation (p. 302)
  • Mechanics (p. 304)
  • Example (p. 305)
  • Chapter 10 Accumulation (p. 311)
  • Move Accumulation to Collecting Parameter (p. 313)
  • Motivation (p. 313)
  • Mechanics (p. 315)
  • Example (p. 315)
  • Move Accumulation to Visitor (p. 320)
  • Motivation (p. 321)
  • Mechanics (p. 325)
  • Example (p. 330)
  • Chapter 11 Utilities (p. 339)
  • Chain Constructors (p. 340)
  • Motivation (p. 341)
  • Mechanics (p. 341)
  • Example (p. 341)
  • Unify Interfaces (p. 343)
  • Motivation (p. 344)
  • Mechanics (p. 344)
  • Example (p. 345)
  • Extract Parameter (p. 346)
  • Motivation (p. 346)
  • Mechanics (p. 347)
  • Example (p. 347)
  • Afterword (p. 349)
  • References (p. 351)
  • Index (p. 355)

Excerpt provided by Syndetics

What Is This Book About? This book is about the marriage of refactoring--the process of improving the design of existing code--with patterns, the classic solutions to recurring design problems. Refactoring to Patterns suggests that using patterns to improve an existing design is better than using patterns early in a new design. This is true whether code is years old or minutes old. We improve designs with patterns by applying sequences of low-level design transformations, known as refactorings. What Are the Goals of This Book? This book was written to help you: Understand how to combine refactoring and patterns Improve the design of existing code with pattern-directed refactorings Identify areas of code in need of pattern-directed refactorings Learn why using patterns to improve existing code is better than using patterns early in a new design To achieve these goals, this book includes the following features: A catalog of 27 refactorings Examples based on real-world code, not the toy stuff Pattern descriptions, including real-world pattern examples A collection of smells (i.e., problems) that indicate the need for pattern-directed refactorings Examples of different ways to implement the same pattern Advice for when to refactor to, towards, or away from patterns To help individuals or groups learn the 27 refactorings in the book, you'll find a suggested study sequence on the inside back cover of the book. Who Should Read This Book? This book is for object-oriented programmers engaged in or interested in improving the design of existing code. Many of these programmers use patterns and/or practice refactoring but have never implemented patterns by refactoring; others know little about refactoring and patterns and would like to learn more. This book is useful for both greenfield development, in which you are writing a new system or feature from scratch, and legacy development, in which you are mostly maintaining a legacy system. What Background Do You Need? This book assumes you are familiar with design concepts like tight coupling and loose coupling as well as object-oriented concepts like inheritance, polymorphism, encapsulation, composition, interfaces, abstract and concrete classes, abstract and static methods, and so forth. I use Java examples in this book. I find that Java tends to be easy for most object-oriented programmers to read. I've gone out of my way to not use fancy Java features, so whether you code in C++, C#, Visual Basic .NET, Python, Ruby, Smalltalk, or some other object-oriented language, you ought to be able to understand the Java code in this book. This book is closely tied to Martin Fowler's classic book Refactoring F. It contains references to low-level refactorings, such as: Extract Method Extract Interface Extract Superclass Extract Subclass Pull Up Method Move Method Rename Method Refactoring also contains references to more sophisticated refactorings, such as: Replace Inheritance with Delegation Replace Conditional with Polymorphism Replace Type Code with Subclasses To understand the pattern-directed refactorings in this book, you don't need to know every refactoring listed above. Instead, you can follow the example code that illustrates how the listed refactorings are implemented. However, if you want to get the most out of this book, I do recommend that you have Refactoring close by your side. It's an invaluable refactoring resource, as well as a useful aid for understanding this book. The patterns I write about come from the classic book Design Patterns DP, as well as from authors such as Kent Beck, Bobby Woolf, and myself. These are patterns that my colleagues and I have refactored to, towards, or away from on real-world projects. By learning the art of pattern-directed refactorings, you'll understand how to refactor to, towards, or away from patterns not mentioned in this book. You don't need expert knowledge of these patterns to read this book, though some knowledge of patterns is useful. To help you understand the patterns I've written about, this book includes brief pattern summaries, UML sketches of patterns, and many example implementations of patterns. To get a more detailed understanding of the patterns, I recommend that you study this book in conjunction with the patterns literature I reference. This book uses UML 2.0 diagrams. If you don't know UML very well, you're in good company. I know the basics. While writing this book, I kept the third edition of Fowler's UML Distilled Fowler, UD close by my side and referred to it often. How to Use This Book To get a high-level understanding of the refactorings in this book, you can begin by studying each refactoring's summary (see Format of the Refactorings, 47), as well as its Benefits and Liabilities box, which appears at the end of each refactoring's Motivation section. To get a deeper understanding of the refactorings, you'll want to study every part of a refactoring, with the exception of the Mechanics section. The Mechanics section is special. It's intended to help you implement a refactoring by suggesting what low-level refactorings to follow. To understand a refactoring in this book, you don't have to read the Mechanics section. You're more likely to use the Mechanics section as a reference when you're actually refactoring. The coding smells described in this book and in Refactoring F provide a useful way to identify a design problem and find associated refactorings to help fix the problem. You can also scan the alphabetized listing of refactorings (on the inside covers of this book and Refactoring ) to find a refactoring that can help improve a design. This book documents the refactorings that take a design either to, towards, or away from a pattern. To help you figure out what direction to go in, you'll find a section on this subject (called Refactoring to, towards, and away from Patterns, 29) as well as a table (listed on the inside front cover) that shows each pattern name and the refactorings you can apply to take a design to, towards, or away from the pattern. The History of This Book I began writing this book sometime in 1999. At the time, there were several forces driving me to write about patterns, refactoring, and extreme programming (XP) Beck, XP. First, I was surprised that patterns had not been mentioned in the XP literature. This led me to write a paper called "Patterns & XP" Kerievsky, PXP in which I publicly discussed the subject and offered some suggestions on how to integrate these two great contributions to our field. Second, I knew that Martin Fowler had included only a few refactorings to patterns in Refactoring F, and he clearly stated that he hoped someone would write more. That seemed like a worthwhile goal. Finally, I noticed that people in The Design Patterns Workshop, a class that my colleagues and I teach, needed more help in figuring out when to actually apply a pattern to a design. It's one thing to learn what a pattern is and an altogether different thing to really understand when and how to apply the pattern. I thought that these students needed to study real-world examples of cases where applying a pattern to a design makes sense, and thus I began compiling a catalog of such examples. As soon as I began writing this book, I followed Bruce Eckel's lead and placed my rather rough contents on the Web to obtain feedback. The Web is indeed a beautiful thing. Many folks responded with suggestions, encouragement, and appreciation. As my writings and ideas matured, I began presenting the subject of Refactoring to Patterns in conference tutorials and during Industrial Logic's intensive patterns and refactoring workshops. This led to more suggestions for improvement and many ideas on what programmers needed to understand this subject. Gradually I came to see that patterns are best viewed in the light of refactoring and that they are destinations best reached by applying sequences of lowlevel refactorings. When my writings began to resemble a book, rather than a long paper, I was fortunate enough to have many experienced practitioners review my work and offer suggestions for improvement. You can read more about these folks in the Acknowledgments section. Standing on the Shoulders of Giants In the summer of 1995, I walked into a bookstore, encountered the book Design Patterns DP for the first time, and fell in love with patterns. I wish to thank the authors, Erich Gamma, Richard Helm (whom I still haven't met), Ralph Johnson, and John Vlissides for writing such an excellent piece of literature. The wisdom you shared in your book has helped me become a much better software designer. Somewhere around 1996, before he became famous, I met Martin Fowler at a patterns conference. It was to be the beginning of a long friendship. I doubt whether I would have written this book if Martin (and his colleagues, Kent Beck, William Opdyke, John Brant, and Don Roberts) had not written the classic book Refactoring F. Like Design Patterns , Refactoring utterly changed the way I approach software design. My writings in this book could only have happened because of the hard work of the authors of Design Patterns and Refactoring . I can't thank you all enough for your great books. Excerpted from Refactoring to Patterns by Joshua Kerievsky All rights reserved by the original copyright owners. Excerpts are provided for display purposes only and may not be reproduced, reprinted or distributed without the written permission of the publisher.

Author notes provided by Syndetics

Joshua Kerievsky is the founder of Industrial Logic, a company specializing in Extreme Programming.

Powered by Koha