/refactoring

Primary LanguageJavaScriptMIT LicenseMIT

Refactoring

====

Composing Methods(composing methods)

  • Consolidate Conditional Expression
  • Decompose Conditional
  • Extract Method
  • Extract Surrounding Method
  • Extract Variable
  • Form Template Method
  • Inline Method
  • Inline Temp
  • Move Eval from Runtime to Parse Time
  • Remove Assignments to Parameters
  • Replace Loop with Collection Closure Method
  • Replace Method with Method Object
  • Replace Temp with Query
  • Split Temporary Variable
  • Substitute Algorithm

Moving Features Between Objects(moving features)

  • Extract Class
  • Extract Module
  • Hide Delegate
  • Inline Class
  • Inline Module
  • Introduce Foreign Method
  • Introduce Local Extension
  • Move Field
  • Move Method
  • Remove Middle Man

Organizing Data(organizing data)

  • Change Bidirectional Association to Unidirectional
  • Change Reference to Value
  • Change Unidirectional Association to Bidirectional
  • Change Value to Reference
  • Duplicate Observed Data
  • Eagerly Initialized Attribute
  • Encapsulate Collection
  • Encapsulate Field
  • Lazily Initialized Attribute
  • Replace Array with Object
  • Replace Data Value with Object
  • Replace Magic Number with Symbolic Constant
  • Replace Record with Data Class
  • Replace Subclass with Fields
  • Replace Type Code with Class
  • Replace Type Code with State/Strategy
  • Replace Type Code with Subclasses
  • Self Encapsulate Field

Simplifying Conditional Expressions(conditionals)

  • Consolidate Conditional Expression
  • Consolidate Duplicate Conditional Fragments
  • Decompose Conditional
  • Introduce Assertion
  • Introduce Null Object
  • Recompose Conditional
  • Remove Control Flag
  • Replace Conditional with Polymorphism
  • Replace Exception with Test
  • Replace Nested Conditional with Guard Clauses

Making Method Calls Simpler(method calls)

  • Add Parameter
  • Encapsulate Downcast
  • Hide Method
  • Introduce Expression Builder
  • Introduce Gateway
  • Introduce Named Parameter
  • Introduce Parameter Object
  • Parameterize Method
  • Preserve Whole Object
  • Remove Control Flag
  • Remove Named Parameter
  • Remove Parameter
  • Remove Setting Method
  • Rename Method
  • Replace Constructor with Factory Method
  • Replace Error Code with Exception
  • Replace Exception with Test
  • Replace Parameter with Explicit Methods
  • Replace Parameter with Method
  • Separate Query from Modifier

Dealing with Generalization(inheritance)

  • Collapse Hierarchy
  • Encapsulate Downcast
  • Extract Interface
  • Extract Module
  • Extract Subclass
  • Extract Superclass
  • Form Template Method
  • Introduce Null Object
  • Pull Up Constructor Body
  • Pull Up Field
  • Pull Up Method
  • Push Down Field
  • Push Down Method
  • Replace Abstract Superclass with Module
  • Replace Conditional with Polymorphism
  • Replace Delegation With Hierarchy
  • Replace Delegation with Inheritance
  • Replace Inheritance with Delegation
  • Replace Subclass with Fields
  • Replace Type Code with Subclasses