The path
Refactoring
Refactoring is improving the design without changing the behavior, in small steps and with the tests green the whole time. It is what makes evolutionary design possible: you don't need to get the design right upfront if you can improve it safely every day.
Topics
Refactoring Basics
Process, Baby Steps
Code Smells
Mysterious Name, Duplicated Code, Long Function, Long Parameter List, Global Data, Mutable Data, Divergent Change, Shotgun Surgery, Feature Envy, Data Clumps, Primitive Obsession, Repeated Switches, Loops, Lazy Element, Speculative Generality, Temporary Field, Message Chains, Middle Man, Insider Trading, Large Class, Data Class, Refused Bequest, Comments
Basic Refactorings
Extract Function/Method, Inline Function/Method, Extract Variable, Inline Variable, Change Function Declaration, Encapsulate Variable, Rename Variable, Introduce Parameter Object, Combine Functions into Class, Combine Functions into Transform, Split Phase
Encapsulation Refactorings
Encapsulate Record, Encapsulate Collection, Replace Primitive with Object, Replace Temp with Query, Extract Class, Inline Class, Hide Delegate, Remove Middle Man, Substitute Algorithm
Moving Features Refactorings
Move Function, Move Field, Move Statements into Function, Move Statements to Callers, Replace Inline Code with Function Call, Slide Statements, Split Loop, Replace Loop with Pipeline, Remove Dead Code
Organizing Data Refactorings
Split Variable, Rename Field, Replace Derived Variable with Query, Change Reference to Value, Change Value to Reference
Conditional Logic Refactorings
Decompose Conditional, Consolidate Conditional Expression, Replace Nested Conditional with Guard Clauses, Replace Conditional with Polymorphism, Introduce Special Case, Introduce Null Object, Introduce Assertion
API Refactorings
Separate Query from Modifier, Parameterize Function, Remove Flag Argument, Preserve Whole Object, Replace Parameter with Query, Replace Query with Parameter, Remove Setting Method, Replace Constructor with Factory Function, Replace Function with Command, Replace Command with Function
Inheritance Refactorings
Pull Up Method, Pull Up Field, Pull Up Constructor Body, Push Down Method, Push Down Field, Replace Type Code with Subclasses, Remove Subclass, Extract Superclass, Collapse Hierarchy, Replace Subclass with Delegate, Replace Superclass with Delegate
Resources
- Refactoring - Improving the Design of Existing Code, 2nd ed
Book · Martin Fowler, Addison-Wesley, 2018 · Whole book · 455 pages
- Replace nested conditionals with guard clauses
Article · 1 pages
- Catalog of Code Smells
Link · 23 pages

