坏味道(smell) | 常用的重构手法(Common Refactoring) |
Alternative Classes with Different Interfaces, p85 |
Rename Method (273), Move Method (142) |
Comments, p87 | Extract Method (110), Introduce Assertion (267) |
Data Class, p86 | Move Method (142), Encapsulate Field (206), Encapsulate Collection (208) |
Data Clumps, p81 | Extract Class (149), Introduce
Parameter Object (295), Preserve Whole Object (288) |
Divergent Change, p79 | Extract Class (149) |
Duplicated Code, p76 | Extract Method (110), Extract Class (149), Pull Up Method (322), Form Template Method (345) |
Feature Envy, p80 | Move Method (142), Move Field (146), Extract Method(110) |
Inappropriate Intimacy, p85 |
Move Method (142), Move Field (146), Change
Bidirectional Association to Unidirectional (200), Replace Inheritance with Delegation (352), Hide Delegate (157) |
Incomplete Library Class, p86 |
Introduce Foreign Method (162), Introduce Local Extension (164) |
Large Class, p78 | Extract Class (149), Extract Subclass (330), Extract Interface (341), Replace Data Value with Object (175) |
Lazy Class, p83 | Inline Class (154), Collapse Hierarchy (344) |
Long Method, p76 | Extract Method (110), Replace Temp With
Query (120), Replace Method with Method Object (135), Decompose Conditional (238) |
Long Parameter List, p78 |
Replace Parameter with Method (292), Introduce Parameter Object (295), Preserve Whole Object (288) |
Message Chains, p84 | Hide Delegate (157) |
Middle Man, p85 | Remove Middle Man (160), Inline Method (117), Replace Delegation with Inheritance (355) |
Parallel Inheritance Hierarchies, p83 |
Move Method (142), Move Field (146) |
Primitive Obsession, p81 | Replace Data Value with Object (175), Extract Class (149), Introduce Parameter Object (295), Replace Array with Object (186), Replace Type Code with Class (218), Replace Type Code with Subclasses (223) |
Refused Bequest, p87 | Replace Inheritance with Delegation (352) |
Shotgun Surgery, p80 | Move Method (142), Move Field (146), Inline Class (154) |
Speculative Generality, p83 |
Collapse Hierarchy (344), Inline Class (154), Remove Parameter (277), Rename Method (273) |
Switch Statements, p82 | Replace Conditional with Polymorphism (255), Replace Type Code with Subclasses (223), Replace Type Code with State/Strategy (227), Replace Parameter with Explicit Methods (285) |
Temporary Field, p84 | Extract Class (149), Introduce Null Object (260) |