Start free trial
Trending New Genres Authors
EnglishEnglish
EspañolSpanish
简体中文Chinese
繁體中文Chinese (Traditional)
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
Searching...
SoBrief
Refactoring to Patterns

Refactoring to Patterns

Turn tangled code into clearer designs, one tested change at a time.
by Joshua Kerievsky 2004 367 pages
4.05
1k+ ratings
Listen
Immersive
V2.3
Amazon Kindle Audible
Try Full Access for 3 Days
Unlock listening & more!
Continue

Key Takeaways

Treat patterns as destinations, not blueprints for code you have not needed.

Design should evolve. A design pattern describes a proven structure for a recurring problem. Refactoring is the behavior-preserving process of changing code internally so it becomes easier to understand or modify. Kerievsky’s central idea is to use refactoring to move existing code toward a pattern when a concrete need appears, rather than copying a pattern’s diagram into a new system before its requirements are clear.

Follow the problem’s trail. The book’s 27 pattern-directed refactorings show how a sequence of small changes can lead to a larger design improvement. A pattern is useful not because its name is prestigious, but because its structure removes duplication, clarifies intent, or simplifies a real complication.

Analysis

This approach treats design as a hypothesis that must earn its place in working code. That is a useful corrective to architecture by analogy, where a familiar diagram can feel like evidence even when the system has not demonstrated the problem it solves. The important distinction is between knowing a pattern and having a reason to use it. The method does not reject planning; it asks designers to keep plans revisable as evidence accumulates.

Let tests make large design changes safe by keeping each step small.

Use a short feedback loop. Test-driven development alternates among writing a failing test, adding enough code to pass it, and improving the design without changing observable behavior. Automated tests provide a quick check that a refactoring has not broken existing behavior. The book argues for continuously refactoring, not waiting for a special cleanup phase.

Big steps waste time. In a workshop, a programmer attempted a substantial refactoring just before lunch, expecting to finish in five minutes. Several tests failed, and the pair spent nearly an hour repairing the change. They had combined several transformations instead of checking the system after each small one. The lesson is practical: when tests stay broken for too long, undo the risky leap and find smaller steps.

Analysis

Small transformations reduce the cost of diagnosing mistakes because fewer changes can be responsible for a failure. This resembles fault isolation in safety-critical engineering: systems are easier to repair when changes are observable and bounded. Tests, however, are only as protective as their coverage and assertions. A green test suite can miss behavior nobody thought to specify, so test confidence should be paired with code review, representative scenarios, and attention to external contracts.

Use a pattern only when it removes a specific, visible design cost.

Elegance can overbuild. Kerievsky describes becoming so enthusiastic about patterns that he proposed a Decorator for a small display problem. A programming partner instead created a simple wrapper class, under ten lines long. The Decorator approach would have required more than 50 lines, much of it repetitive delegation. The smaller solution met the need without adding a larger structure to understand.

Patterns are tools, not trophies. A pattern may reduce duplicated code or conditional complexity, yet still be the wrong choice if a few clear methods solve the problem. The book recommends evaluating the resulting design, not celebrating the presence of a pattern. If the transformation makes code harder to follow, stop, reverse course, or try another direction.

Analysis

The example captures a common professional trap: visible sophistication can be mistaken for quality. A useful design has a cost-benefit profile, including the future cost of teaching and maintaining its abstractions. Still, line count alone is a weak measure. A longer structure may be justified when it creates a stable extension point or prevents repeated defects. The better test is whether the additional concept pays for itself in the system’s actual usage.

Read code smells as clues to design debt, not orders to add patterns.

Look for recurring friction. Code smells are recognizable signs that code may be duplicated, unclear, or unnecessarily complicated. The book groups problems such as long methods, conditional complexity, primitive obsession, large classes, and inconsistent interfaces, then connects them to possible refactorings. A smell is a prompt to investigate, not proof that one particular pattern is required.

Debt compounds quietly. Design debt accumulates when teams leave duplication in place, tolerate complicated code, or fail to clarify intent. Like financial debt, it makes later changes more expensive. One example is a large class that causes programmers to spend extra time coordinating merges whenever they update it. Regularly paying down these small costs can keep routine feature work from slowing into a major rewrite.

Analysis

The debt metaphor helps make maintenance costs legible to people who do not think in terms of class structure. It also frames cleanup as an investment rather than a preference for tidy code. Yet debt is not automatically bad: a deliberate shortcut can be rational under a deadline if the team understands its cost and tracks it. The danger is unrecorded borrowing, especially when each local expedient makes the next change harder to estimate.

Match the pattern to the variation: algorithm, state, request, or language.

Different problems need different structures. Strategy separates competing versions of an algorithm into interchangeable objects. State moves complicated state transitions into classes representing individual states. Command turns request-handling branches into separate action objects that can be selected and run uniformly. Interpreter models a small language, such as combined search criteria, as objects that can be composed and evaluated.

Choose by the source of complexity. A loan calculator used Strategy because capital calculations varied by loan type and could change at runtime. A permission system used State when added permission steps made conditional transitions hard to follow. A large web application dispatcher became easier to extend when each action had a Command. Product searches with combinations of color, price, and size could use Interpreter-like specifications instead of a growing list of specialized finder methods.

Analysis

This is a diagnostic way to learn patterns: first name what varies, then choose a structure that localizes that variation. It discourages treating every conditional as a defect. Conditionals can be clearer when cases are few and stable; object families become valuable when variation grows, must be substituted, or is maintained independently. The decision is less about whether polymorphism is fashionable and more about which future change the design is trying to make cheaper.

Use Composite when one-versus-many code keeps splitting your clients’ logic.

Make trees explicit when useful. A Composite represents individual objects and groups of those objects through a shared interface, allowing clients to process either uniformly. In an XML writer, repeated string concatenation and manual tag formatting were replaced by TagNode objects arranged in a tree. Each node handled its own output, while parent nodes managed children. This reduced repetitive construction instructions and made the structure visible in the code.

Hide construction when it is burdensome. A Builder can sit between clients and a complicated Composite, creating and positioning children on their behalf. Kerievsky’s TagBuilder helped clients build XML without repeatedly managing parent-child links. In product searches, a Composite specification can represent one criterion or combine several, including AND, OR, and NOT, so clients use one selection path instead of separate single-item and collection methods.

Analysis

Making a hidden structure explicit can simplify operations that repeatedly reconstruct the same relationships. It can also add indirection, memory use, and concepts that are unnecessary for small or one-off tasks. Builders are especially useful when construction itself is error-prone, not simply because an object graph exists. The design question is whether clients benefit from expressing the structure directly, or whether a straightforward local representation remains easier to read.

Centralize creation only when it removes real sprawl or clarifies what clients need.

Make creation intention clear. A class with many constructors can be hard to use because their names do not explain what kind of object each creates. A Creation Method is a named method that constructs and returns an instance, such as a method that clearly identifies a term loan. In the book’s loan example, several constructors obscured how dates and null arguments distinguished loan types. Named creation methods made those distinctions explicit.

Factories need a job. A Factory gathers object-creation knowledge, particularly when that knowledge or configuration is scattered across multiple classes. It can also hide implementation classes so clients work through a shared interface. But a Factory that merely moves one simple conditional elsewhere may add complexity without benefit. Consolidate creation when it reduces duplicated decisions, prevents misuse, or keeps implementation details out of clients.

Analysis

Creation code often exposes architectural boundaries: it reveals which parts of a system know concrete types and which parts should not. Named constructors improve local readability, while factories can establish broader control over configuration and dependency choices. Those are different needs and should not be collapsed into one abstraction. Centralization can also become a bottleneck if every new product requires edits to a single factory, so the expected rate and ownership of change matter.

Isolate optional behavior and unstable APIs behind the right boundary.

Separate what changes independently. Decorator adds optional behavior by wrapping an object that shares its interface. In the HTML parser example, repeated client code decoded encoded text; moving decoding into a Decorator made the feature reusable without placing all its logic in the core text node. Strategy is a better fit when a host object selects an algorithm internally, while Decorator is suited to behavior that clients can attach around an object.

Adapt what cannot be changed. An Adapter gives differently shaped classes a common interface, useful when a third-party library or older API cannot be edited. Observer is appropriate when one source must notify multiple interested objects, rather than a single hard-coded recipient. Each pattern has costs: wrappers can complicate debugging, adapters can hide useful operations, and observers need lifecycle care.

Analysis

These patterns are all boundary-management techniques, but they protect different boundaries: optional behavior, incompatible interfaces, and changing audiences. Treating them as interchangeable ways to eliminate conditionals obscures their distinct responsibilities. A strong boundary limits the spread of change; a weakly chosen one merely relocates complexity. The section’s emphasis on evolving from a simpler arrangement is valuable because it lets actual reuse and change pressure reveal which boundary is missing.

Use a Visitor for genuinely heterogeneous data, not merely because it is available.

Pick the accumulation method that fits. A Collecting Parameter is an object passed through methods so each can add information to a shared result. It works well when visited objects have similar interfaces or when a recursive structure contributes to one output. The XML example uses a shared buffer as the result while nodes append their contents.

Use Visitor for varied interfaces. A Visitor handles operations across different object types through type-specific visit methods, avoiding repeated type checks and casts. The HTML parser’s text extraction needed different data from string nodes, links, and tags, so a Visitor made those cases explicit. Visitor is more involved, and adding a new visitable class requires support in the visitor interface. If a common interface or simpler accumulator works, prefer that.

Analysis

The choice turns on whether the data sources are uniform, not on which pattern is more sophisticated. A shared accumulator minimizes machinery when each object can contribute through a narrow common protocol. Visitor earns its overhead when an operation must distinguish among heterogeneous types, especially when several such operations exist. There is a design trade-off: Visitor centralizes operations but can make adding new data types more laborious. The likely direction of change should guide the choice.

Pass dependencies explicitly; reserve Singleton for measured sharing needs.

Global access hides relationships. A Singleton guarantees one instance and offers a global access point, but it can make tests depend on shared state. In one example, exchange-rate tests had to save and restore global rates. Passing the rates to the code that needed them took about half an hour and made collaborations clearer. The book’s advice is to remove a Singleton when explicit references are simpler, not to ban the pattern outright.

Optimize with evidence. A team used a profiler to find that repeatedly created, stateless permission-state objects contributed to slow performance under heavy load. Sharing those instances through Singleton improved memory use. A Null Object is another targeted tool: it supplies harmless behavior where repeated null checks otherwise clutter code. It is a poor fit when null has important meaning or few checks exist.

Analysis

Explicit dependencies improve test isolation and make data flow easier to inspect, much as dependency injection makes system configuration visible. Global access remains useful when passing a resource through many layers creates more noise than clarity, so the right answer depends on the shape of the call graph. Performance optimization is strongest when measurement identifies a real bottleneck. Replacing null checks also requires care, since a harmless default can conceal a condition the program ought to report.

Design up front when requirements are fixed and the proposal itself matters.

Evolution is the default, not a law. Kerievsky generally favors building working code, then refactoring toward patterns as needs emerge. But one client project required a detailed design proposal to win the work, and its requirements were unusually stable. Early use of Command and Interpreter helped demonstrate how the site could be configured. The design was implemented closely, although browser defects still delayed delivery by about a month.

Keep the exception contextual. Up-front design is most defensible when requirements are fixed, the project is bounded, and a concrete design is part of the decision to proceed. Otherwise, elaborate plans risk optimizing for features that change or never arrive. The book’s deeper teaching is not to memorize its 27 refactoring recipes, but to learn how designers reason from a specific code problem toward a safer transformation.

Analysis

The story distinguishes two kinds of design work: a design used to guide implementation and a design used to communicate feasibility to a buyer. The latter can have immediate value even before code exists. Stable requirements make early commitments less speculative, but external conditions can still invalidate assumptions, as the browser problems did. A sensible plan therefore includes both a credible design and room to revise it when implementation reveals facts the proposal could not anticipate.

Analysis

The book’s distinctive contribution is not a new inventory of object-oriented patterns. It changes the temporal story told about them. Patterns are often taught as finished structures to recognize and reproduce. Kerievsky instead presents them as outcomes of problem-solving: a developer sees duplication, tangled branching, or creation logic scattered across the code, then uses behavior-preserving transformations to move toward a more suitable structure. That shift makes pattern knowledge practical rather than ceremonial.

Its strongest discipline is the repeated insistence that a destination is optional. A refactoring sequence is a route, not a commandment. Developers may stop partway when the design has improved enough, reverse direction when complexity increases, or choose a simpler solution altogether. This makes the catalog less like a recipe book and more like worked examples of design judgment. The stories matter because the same pattern can be helpful in one context and wasteful in another.

The method also links technical quality to economic consequences. Design debt shows how local shortcuts raise the cost of later changes, while tests and small steps lower the risk of paying that debt down. That connection is persuasive, though it depends on teams having time to maintain useful tests and permission to refactor. Tests cannot guarantee that every relevant behavior has been captured, and automated tools cannot decide whether a new abstraction is worth its maintenance cost. The book’s examples come from object-oriented systems and use patterns familiar in Java-era design. Some mechanics will not transfer directly to every language or modern architecture. Its deeper principles do transfer: make change boundaries explicit, select abstractions in response to recurring pressure, and preserve behavior while improving structure. Read as a training manual for judgment rather than a checklist of patterns, the book remains valuable well beyond its original code examples.

Summary in 30 Seconds
Refactoring changes a program's internal structure while preserving its behavior. Small steps, checked by automated tests, make substantial design improvements safer and easier to reverse. Patterns are useful when they reduce duplication, tangled conditionals, or unclear responsibilities, but simpler code may be better than a new abstraction. Match structures to the source of complexity, make dependencies visible, and share instances only when evidence shows a need. Treat design as responsive to changing requirements.
Contains spoilers

Last updated:

Report Issue

Review Summary

4.05 out of 5
Average of 1k+ ratings from Goodreads and Amazon.

Refactoring to Patterns receives mixed reviews, with an average rating of 4.06/5. Readers appreciate its practical approach to merging design patterns with refactoring techniques, providing context for when to apply patterns. Many find it valuable for experienced developers but less useful for beginners. Some praise the real-world examples and step-by-step explanations, while others feel the content is redundant if familiar with both refactoring and design patterns. The book is generally recommended as a solid reference for software developers seeking to improve code quality and design.

Your rating:
4.51
167 ratings
Want to read the full book?

Glossary

Pattern-directed refactoring

Refactoring toward a pattern

A sequence of smaller, behavior-preserving code transformations that moves a design toward, to, or away from a design pattern. The pattern supplies a possible destination, while the refactoring steps provide a safer route from the existing code. The goal is improved design, not pattern implementation for its own sake.

Design debt

Accumulated design costs

The extra effort created when code is not regularly clarified, simplified, and relieved of duplication. Kerievsky uses a financial analogy: ignored design problems make future changes more expensive, much as unpaid debt accumulates costs. The term helps teams discuss maintenance work as an investment in future development rather than as cosmetic cleanup.

Singletonitis

Overuse of Singleton

Kerievsky’s term for an excessive attachment to the Singleton pattern. A developer with Singletonitis uses global access and enforced single instances by habit, even when ordinary objects passed explicitly would be simpler. The book recommends reserving Singleton for a demonstrated need, such as measured performance improvement or genuinely useful shared state.

Creation Method

Named object-creation method

A static or instance method that creates and returns an object. Kerievsky distinguishes it from the Factory Method pattern: a Creation Method can simply name a useful construction option, while a Factory Method enables polymorphic creation through implementations in a class hierarchy. Clear method names can reveal the kind of instance being created more effectively than constructors.

Factory Method

Polymorphic object creation

A method that creates and returns an instance of a base type or interface, with implementations in a class and one or more subclasses. Those implementations can choose different concrete products while sharing a common method signature. In Kerievsky’s account, it is useful when similar methods differ mainly in which object they create.

Collecting Parameter

Shared result accumulator

An object passed to methods so they can contribute information to a result as the program proceeds. For example, several nodes in an XML tree can append their output to the same buffer. This can simplify a bulky method and avoid creating separate intermediate results, especially when the contributing objects have similar interfaces.

Combinatorial Explosion

Too many criterion combinations

A code smell in which separate methods or branches are added for many combinations of inputs or conditions. Product-search methods, for example, can multiply as new combinations of color, size, and price are supported. An explicit language of composable criteria can replace the growing collection of special-case methods.

Specification

Composable selection criterion

An object that represents a rule for selecting or evaluating domain objects. Individual specifications can express criteria such as a product’s color or price, while composite specifications combine them using operations such as AND, OR, or NOT. This makes queries composable instead of requiring a separate finder method for every combination.

Null Object

Object with harmless default behavior

An object assigned where a reference might otherwise be null, implementing do-nothing, default, or otherwise safe behavior. Calls can then proceed without repeated null checks. A Null Object is appropriate when the default behavior is genuinely acceptable; it can be misleading when null signals an important error or requires distinct handling.

Code smell

Clue to design trouble

A recognizable feature of code that suggests a design may be difficult to understand, change, or extend. Examples include long methods, duplicated logic, large classes, and sprawling conditional statements. A smell is a reason to inspect the design and consider a refactoring, not an automatic instruction to apply a particular pattern.

FAQ

What is Refactoring to Patterns by Joshua Kerievsky about?

  • Combines refactoring and patterns: The book explores how to improve existing codebases by incrementally applying design patterns through safe, behavior-preserving refactorings.
  • Focus on evolutionary design: It emphasizes evolving software designs over time, rather than relying solely on up-front architecture.
  • Practical catalog and examples: Readers are provided with a catalog of 27 pattern-directed refactorings, real-world code examples, and guidance on recognizing design smells.
  • Bridges two disciplines: The book unites the worlds of refactoring and design patterns, showing how they can work together to create cleaner, more maintainable code.

Why should I read Refactoring to Patterns by Joshua Kerievsky?

  • Bridges theory and practice: The book fills a gap by showing how to introduce design patterns incrementally, avoiding both over-engineering and under-engineering.
  • Step-by-step guidance: It offers detailed, accessible refactoring steps with real-world examples, making it suitable even for those with limited experience in patterns or refactoring.
  • Improves code quality: By learning pattern-directed refactorings, readers can reduce duplication, clarify intent, and make codebases more maintainable.
  • Essential for legacy code: The techniques are especially valuable for improving legacy systems or evolving complex codebases without breaking existing behavior.

What are the main goals and key takeaways from Refactoring to Patterns by Joshua Kerievsky?

  • Synergy of patterns and refactoring: Learn how to combine refactoring techniques with design patterns to improve codebases effectively and safely.
  • Recognize and address design smells: The book teaches how to identify 12 common code smells that signal the need for pattern-directed refactorings.
  • Safe, incremental improvement: Emphasizes using sequences of low-level refactorings to evolve designs, ensuring behavior is preserved at every step.
  • Multiple paths to patterns: Demonstrates that there are often several ways to implement or approach a pattern, encouraging thoughtful, context-driven design decisions.

What background knowledge is recommended for reading Refactoring to Patterns by Joshua Kerievsky?

  • Object-oriented programming basics: Familiarity with concepts like inheritance, polymorphism, encapsulation, and interfaces is assumed.
  • Refactoring fundamentals: Understanding basic refactorings (e.g., Extract Method, Move Method) is helpful; having Martin Fowler’s Refactoring book as a reference is suggested.
  • Design patterns awareness: Some knowledge of classic design patterns (from the GoF book) is useful, but not required, as the book provides summaries and UML diagrams.
  • Test-driven development familiarity: While not mandatory, understanding TDD concepts will help in applying the book’s advice on safe, incremental changes.

How does Refactoring to Patterns by Joshua Kerievsky define and use "pattern-directed refactorings"?

  • Definition: Pattern-directed refactorings are sequences of low-level, behavior-preserving changes that move code toward, to, or away from a design pattern.
  • Purpose: They provide a guided, incremental path for evolving code, helping avoid premature or unnecessary pattern implementations.
  • Structure: Each refactoring includes motivation, step-by-step mechanics, real-world examples, and a discussion of benefits and liabilities.
  • Empowers developers: This approach enables programmers to confidently apply patterns in a way that fits their code’s current needs and context.

What are the most important design smells discussed in Refactoring to Patterns by Joshua Kerievsky, and how do they relate to patterns?

  • Twelve key smells: Examples include Duplicated Code, Long Method, Conditional Complexity, Primitive Obsession, Indecent Exposure, Solution Sprawl, and Large Class.
  • Smells as refactoring signals: Each smell indicates a specific area where pattern-directed refactorings can improve the design.
  • Patterns as solutions: The book maps common smells to appropriate patterns, such as using Template Method to remove duplication or Strategy to simplify conditionals.
  • Guides code evolution: Recognizing these smells helps developers decide when and how to refactor toward patterns for cleaner, more maintainable code.

How does Refactoring to Patterns by Joshua Kerievsky explain the relationship between refactoring and design patterns?

  • Patterns as design targets: Patterns represent desirable structures, while refactorings are the means to evolve code toward those structures.
  • Evolutionary, not revolutionary: The book advocates for small, safe steps rather than big, up-front pattern implementations.
  • Synergy and balance: Understanding when and why to refactor to, towards, or away from patterns helps avoid both over-engineering and under-engineering.
  • Patterns as flexible goals: The approach encourages using patterns as guides, not rigid templates, adapting them to the code’s evolving needs.

What is the difference between refactoring to, towards, and away from patterns in Refactoring to Patterns by Joshua Kerievsky?

  • Refactoring to a pattern: Fully implements a design pattern to achieve a clear design improvement, such as applying the Template Method.
  • Refactoring towards a pattern: Makes partial improvements that move the design closer to a pattern, stopping if sufficient clarity or simplicity is achieved.
  • Refactoring away from a pattern: Removes or simplifies a pattern when it adds unnecessary complexity, such as inlining a Singleton.
  • Context-driven decisions: The book emphasizes choosing the right direction based on the code’s current needs and future evolution.

How does Refactoring to Patterns by Joshua Kerievsky recommend using test-driven development (TDD) and continuous refactoring?

  • TDD as a safety net: Write a failing test, make it pass, then refactor—repeating this cycle to ensure safe, incremental improvements.
  • Supports safe refactoring: Automated tests provide confidence that behavior is preserved during each refactoring step.
  • Composite and test-driven refactorings: The book distinguishes between composite refactorings (sequences of small steps) and test-driven refactorings (reimplementing code guided by tests).
  • Enables evolutionary design: This approach allows for continuous, low-risk evolution of codebases.

What are some key pattern-directed refactorings covered in Refactoring to Patterns by Joshua Kerievsky?

  • Creation patterns: Includes Replace Constructors with Creation Methods, Move Creation Knowledge to Factory, and Introduce Polymorphic Creation with Factory Method.
  • Simplification patterns: Covers Compose Method, Replace Conditional Logic with Strategy, and Move Embellishment to Decorator.
  • Generalization and protection: Features Form Template Method, Extract Composite, Replace State-Altering Conditionals with State, Introduce Null Object, and Inline Singleton.
  • Accumulation and utilities: Discusses Move Accumulation to Collecting Parameter, Move Accumulation to Visitor, Chain Constructors, and Unify Interfaces.

How does Refactoring to Patterns by Joshua Kerievsky detail the process of refactoring to the Decorator pattern?

  • Stepwise transformation: The book walks through refactoring a class (e.g., StringNode) to use Decorator, starting by identifying an interface and moving embellishment logic into decorator classes.
  • From inheritance to delegation: It demonstrates breaking inheritance in favor of delegation, creating delegate fields and forwarding methods to enable flexible decoration.
  • Parameter extraction: The process includes extracting parameters to pass decorated instances and ensuring the decorator fully implements the interface.
  • Avoids recursion pitfalls: Special attention is given to handling infinite recursion and ensuring the decorator pattern is implemented transparently.

What is the motivation and benefit of replacing state-altering conditionals with the State pattern in Refactoring to Patterns by Joshua Kerievsky?

  • Simplifies complex state logic: The main motivation is to tame sprawling conditional logic that controls state transitions, which can be hard to maintain.
  • Encapsulates state behavior: The State pattern moves state-specific behavior and transitions into separate classes, clarifying the design.
  • Improves extensibility: This approach makes it easier to add new states or transitions without modifying existing code.
  • Reduces conditional clutter: By removing or reducing state-changing conditionals, the code becomes simpler and more maintainable.

What is the overall philosophy and advice in the Afterword of Refactoring to Patterns by Joshua Kerievsky?

  • Refactoring as design algebra: The book likens refactoring to algebra and design patterns to word problems, emphasizing the importance of understanding the thought process behind transformations.
  • Focus on understanding: The true value lies in grasping the underlying patterns and insights, not just memorizing specific refactorings.
  • Primer, not a cookbook: Readers are encouraged to study the examples to internalize the approach, rather than treating the book as a set of recipes.
  • Empowers creative problem-solving: This mindset enables developers to apply principles flexibly and effectively to a wide range of design challenges.

About the Author

Joshua Kerievsky is a software developer and author known for his expertise in agile development practices and design patterns. He is the founder and CEO of Industrial Logic, a company that provides training and consulting services in software development. Kerievsky is recognized for his contributions to the field of software engineering, particularly in the areas of refactoring and design patterns. He has written extensively on these topics and is a frequent speaker at industry conferences. His work focuses on helping developers improve their skills and create more maintainable, efficient code through the application of proven design principles and refactoring techniques.

Download PDF

To save this Refactoring to Patterns summary for later, download the free PDF. You can print it out, or read offline at your convenience.
Download PDF
File size: 0.43 MB     Pages: 23

Download EPUB

To read this Refactoring to Patterns summary on your e-reader device or app, download the free EPUB. The .epub digital book format is ideal for reading ebooks on phones, tablets, and e-readers.
Download EPUB
File size: 1.37 MB     Pages: 29
Want to read the full book?
Follow
Listen
Home
Swipe
Library
Get App
Try Full Access for 3 Days
Listen, bookmark, and more
Compare Features Free Pro
📖 Read Summaries
Read unlimited summaries. Free users get 3 per month
🎧 Listen to Summaries
Listen to unlimited summaries in 40 languages
—
❤️ Unlimited Bookmarks
Free users are limited to 4
—
📜 Unlimited History
Free users are limited to 4
—
📥 Unlimited Downloads
Free users are limited to 1
—
Risk-Free Timeline
Today: Get Instant Access
Listen to full summaries of 26,000+ books. That's 12,000+ hours of audio!
Day 2: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 3: Your subscription begins
You'll be charged on Nov 24,
cancel anytime before.
Consume 2.8× More Books
2.8× more books Listening Reading
Our users love us
600,000+ readers
Trustpilot Rating
TrustPilot
4.6 Excellent
This site is a total game-changer. I've been flying through book summaries like never before. Highly, highly recommend.
— Dave G
Worth my money and time, and really well made. I've never seen this quality of summaries on other websites. Very helpful!
— Em
Highly recommended!! Fantastic service. Perfect for those that want a little more than a teaser but not all the intricate details of a full audio book.
— Greg M
Save 62%
Yearly
$119.88 $44.99/year/yr
$3.75/mo
Monthly
$9.99/mo
Start a 3-Day Free Trial
3 days free, then $44.99/year. Cancel anytime.
Unlock a world of fiction & nonfiction books
26,000+ books for the price of 2 books
Read any book in 10 minutes
Discover new books like Tinder
Request any book if it's not summarized
Read more books than anyone you know
#1 app for book lovers
Lifelike & immersive summaries
30-day money-back guarantee
Download summaries in EPUBs or PDFs
Cancel anytime in a few clicks

Why one summary?

Scanner
Find a barcode to scan

⭐
⭐
⭐
We have a special gift for you
Open
38% off
DISCOUNT FOR YOU
⭐
⭐
⭐
$79.99
$49.99/year
Only $4.16 per month
Continue
2 taps to start, super easy to cancel
Settings
General
Widget
Loading...