Note and code sample for reading Refactoring - Improving the design of existing code
The code might not be executed, the main purpose is to interpret the theory of refactoring
- Extract Method
- Inline Method
- Inline Temp
- Replace Temp with Query
- Introducing Explaining Variable
- Split Temporary Variable
- Remove Assignments to Parameters
- Replace Method with Method objects
- Substitute Algorithm
- Move Method
- Move Field
- Extract Class
- Inline Class
- Hide Delegate
- Remove Middle Man
- Introduce Foreign Method
- Introduce Local Extension
- Self Encapsulate Field
- Replace Data Value with Object
- Change Value to Reference
- Change Reference to Value
- Replace Array with Object
- Duplicate Observed Data
- Change Unidirectional Association to Bidirectional
- Change Bidirectional Association to Unidirectional
- Replace Magic Number with Symbolic Constant
- Encapsulate Field
- Encapsulate Collection
- Replace Record with Data Class
- Replace Type Code with Class
- Replace Type Code with subclass
- Replace Type Code with State/Strategy
- Replace Subclass with Fields
- Decompose Conditional
- Consolidate Conditional Expression
- Consolidate Duplicate Conditional Fragments
- Remove Control Flag
- Replace Nested Conditional with Guard Clauses
- Replace Conditional with Polymorphism
- Introduce Null Object
- Introduce Assertion
- Rename Method
- Add Parameter
- Remove Parameter
- Separate Query from Modifier
- ParameterizeMethod
- ReplaceParameterWithExplicitMethods
- Preserve Whole Object
- Replace Parameter with Method
- Introduce Parameter Object
- Remove Setting Method
- Hide Method
- Replace Constructor with Factory Method
- Encapsulate Downcast
- Replace Error Code with Exception
- Replace Exception with Test