Refactoring technique
Bad code smell
The following is from Refactoring – Improving the Design of existing Code
Reorganize functions
1. Extract Method
2. Inline Method
3. Inline Temp
Replace Temp with Query
5. Introducing Explaining variables
6, Split Temporary Variable
7, Remove Assignments to Parameters
Replace Method with Method Object
Is a Substitute Algorithm?
Move between objects
10. Move Method
11. Move Field
12, Extract Class
13, Inline Class
14. Hide Delegate
15, Remove the Middle Man
16, Introduce Foreign Method
17, Introduce Local Extension
Reorganize the data
18, Self Encapsulate Field
19, Replace Data Value with Object
20, Change Value to Reference
21, Change Reference object to Value
22, Replace Array with Object
23, Duplicate Observed Data (Duplicate “monitored Data”)
24, Change Unidirectional Association to Bidirectional
25, Change Bidirectional Association to Unidirectional
26, Replace Magic Number with SymBolic Constant
27. Encapsulated Field
28. Encapsulated Collection
29, Replace Record with Data Class
Replace Type Code with Class
31, Replace Type Code with Subclass
32, Replace Type Code with State/Strategy
33, Replace Subclass with Field
4. Simplify conditional expressions
Decompose Conditional expressions
35, Consolidate Conditional Expression
Consolidate Duplicate Conditional Fragments
37, Remove Control flags
38, Replace Nested Conditional expressions with Guard Clauses
39, Replace Conditional with Polymorphism
40, Introduce Null Object.
41, Introduce Assertion
5. Simplify function calls
42, Rename Method
43, Add Parameter
44, Remove Parameter
45, Separate Query Form Modifier (Separate Query function from modify function)
Parameterize Method Parameterize Method
47, Replace Parameter with Explicit Methods
48, Preserve the Whole Object
49, Replace parameters with Methods
50, Introduce Parameter Object
51, Remove Setting Method
52, Hide Method
53, Replace Factory functions with Factory methods
54. Encapsulate Downcast
55, Replace Error Code with Exception
56, Replace Exception with Test
Handle generalizations
57, Pull Up the Field
58, Pull Up Method
59, Pull Up the Constructor Body
60, Push down Method
61, Push down the field
Extract Subclass
Extract Superclass
Extract Interface
65, Collapse of Hierarch
66, Form Template Method
67, Replace Inheritance with Delegation
68, Replace Delegation with Inheritance