Josua Kerievsky - Refactoring to Patterns

Index do Livro

  1. Por que escrevi o livro
  • 26 => 43 (17 páginas)
  1. Refatoração
  • 43 => 69 (26 páginas)

  • In this chapter I offer a few thoughts on what refactoring is and
    what you need to do to be good at it. This chapter is best read
    in accompaniment with the chapter “Principles in Refactoring”

  1. Padrões
  • 69 => 95 (26 páginas)

  • This chapter looks at what a pattern is; what it means to be
    patterns happy; the importance of understanding that patterns
    can be implemented in many ways; considerations for
    refactoring to, towards, or away from patterns; whether or not
    patterns make code more complex; what it means to have
    “pattern knowledge”; and when it may make sense to do up-
    front design with patterns.

  1. Problemas de códgo (Code Smells)
  • 95 => 117 (22 páginas)
  1. Um catalogo de rafotoraçao de padroes
  • 117 => 130 (13 páginas)

  • This chapter looks at the format of the refactorings in this book,
    the projects referenced in the refactorings, the maturity level of
    the refactorings, as well as a suggested study sequence for the
    catalog.

  1. Criaçao
  • 130 => 247 (117 páginas)
  1. Simplificação
  • 247 => 378 (131 páginas)
  1. Genrealizaçao
  • 378 => 517 (139 páginas)

  • Generalization is the transformation of specific code into
    general-purpose code. The production of generalized code
    frequently occurs as a result of refactoring. All seven
    refactorings in this chapter yield generalized code. The most
    common motivation for applying them is to remove duplicated
    code. A secondary motivation is to simplify or clarify code.

  1. Proteção
  • 517 => 568 (51 páginas)

  • A refactoring that improves the protection of existing code must
    do so in a way that doesn’t alter the behavior of the existing
    code. All three refactorings in this section do just that. Your
    motivation for applying them may be to improve protection or it
    may be a standard refactoring motivation, such as to reduce
    duplication or to simplify or clarify code.

  1. Acumulação
  • 568 => 612 (44 páginas)
  1. Utilitários
  • 612 => 631 (19 páginas)

Bad Smell and Solutions

SmellRefactoring
Duplicated CodeForm Template Method;
Introduce Polymorphic Creation with Factory Method;
Chain Constructors;
Replace One/Many Distinctions with Composite;
Extract Composite;
Unify Intrefaces with Adapter;
Introduce Null Object;
Long MethodCompose Method;
Move Accumulaton to Collecting Parameter;
Replace Conditional Dispatcher with Command;
Move Accumulation to Visitor;
Replace Conditional Logic with Strategy;
Conditional ComplexityReplace Conditional Logic with Strategy;
Move Embellishment to Decorator;
Replace State-Altering Conditionals with State;
Introduce Null Object;
Primitive ObsessionReplace Type Code with Class;
Replace State-Altering Conditionals with State;
Replace Conditional Logic with Strategy;
Replace Implicit Tree with Composite;
Replace Implicitt Language with Interpreter;
Move Embellishment to Decorator;
Encapsulate Composite with Builder;
Indecent ExposureEncapsulate Classes with Factory
Solution SprawlMove Creation KNowledge to Factory
Alternativ Classes
with Diferent Interfaces
Unify Interfaces with Adapter
Lazy ClassInline Singleton
Large ClassReplace Conditional Dispatcher with Command;
Replace State-Altering Conditionals with State;
Replace Implicit Language with Interpreter;
Switch StatementsReplace Condicional Dispatcher with Command;
Move Accumulation to Visitor
Combinatorial ExplosionReplace Implicit Language with Interpreter
Oddball SolutionUnify Interfaces with Adapter

Design Patterns usados nos Refactoring to Patterns

Design to RefactToTowardsAway
AdapterExtract Adapter; Unify Interfaces with Adapter
BuilderEncapsulate Composite with Builder
Collecting ParameterMove Accumulation to Collecting Parameter
CommandReplace Condicional Dispatcher with CommandReplace Considiconal Dispatcher with Command
Composed MethodCompose Method
CompositeReplace One/Many Distinctions with Composite; Extract Composite; Replace implicit Tree with Composite;Encapsulate Composite with Builder
Creation MethodReplace Constructos with Creation Methods
DecoratorMove Embellishment to Decorator;Move Embellishment to Decorator;
FactoryMove Creation Knowledge to Factory; Encapsulate Classes with Factory;
Factory MethodIntroduce Polymorphic Creation with Factory Method
InterpreterReplace Implicit Language with Interpreter
IteratorMove Accumulation to Visitor
Null ObjectIntroduce Null Object
ObserverReplace Hard-Coded Notifications with ObserverReplace Hard-Coded Notifications with Observer
SingletonLimit Instantiation with SingletonInline Singleton
StateReplace State-Altering Conditionals with StateReplace State-Altering Conditionals with State
StrategyReplace Conditional Logic with StrategyReplace Conditional Logic with Strategy
Template MethodForm Template Method
VisitorMove Accumulation to VisitorMove Accumulation to Visitor

Listagem dos Métodos de Refatoração que iremos ver no livro

RefactoringN AlfaOrdem no livro.
Chain Constructors 3400125
Compose Method 1230207
Encapsulate Classes with Factory 800305
Encapsulate Composite with Builder 960418
Extract Adapter 2580514
Extract Composite 2140614
Extract Parameter 3460727
Form Template Method 2050813
Inline Singleton 1140906
Introduce Null Object 3011022
Introduce Polymorphic Creation with Factory Method 881104
Limit Instantiation with Singleton 2961221
Move Accumulation to Collecting Parameter 3131323
Move Accumulation to Visitor 3201424
Move Creation Knowledge to Factory 681502
Move Embellishment to Decorator 1441609
Replace Conditional Dispatcher with Command 1911712
Replace Conditional Logic with Strategy 1291808
Replace Constructors with Creation Methods 571901
Replace Hard-Coded Notifications with Observer 2362016
Replace Implicit Language with Interpreter 2692119
Replace Implicit Tree with Composite 1782211
Replace One/Many Distinctions with Composite 2242315
Replace State-Altering Conditionals with State 1662410
Replace Type Code with Class 2862520
Unify Interfaces 3432626
Unify Interfaces with Adapter 2472717