/*
Author: Jiangong SUN
*/
1. Duplicated code
Extract method or Extract class
2. Long method
Extract method, replace temp variable by query, Parameter object (DTO), Replace method by method object,
3. Large class
Extract class, extract subclass,
4. Long parameter list
Preserve whole object, Introduce parameter object
5. Divergent change
Extract class: divide class into different sub classes, in this way, several changes in a class can be made into several sub classes.
6. Modify the volume gun surgery volume bullet; opposite to the divergent change
Move method, move field: put all codes need to be modified into a class for preventing from forgetness in a lot of differenct classes.
7. Feature Envy attachment
Symptom: a method use a lot of method in another class.
Move method, Strategy, Visitor pattern
8. Data clumps Data dashboard
9. Basic Primitive obsession type paranoia
Replace data value with object, replace type code with class
10. Switch statements
Replace conditional with polymorphism
11. Parallel inheritance hierarchies Parallel inheritance System
Symptom: when you create a subclass for a class, you have to create a subclass for another class.
Solution: make sure that instances of one hierarchy refer to instances of the other
12. Lazy class redundancy class
Symptom: a class is not doing a lot of work
Solution: inline class, means moving all it's features into another class.
13. speculative generality exaggerated the future
Remove parameter, collapse hierarchy, inline class
14. temporary field
Extract class, introduce nullable object
15. message chains over-coupled information chain
Symptom: You see message chains when a client asks one object for another object, which the client then asks for yet another object, which the client then asks for yet another object, and so on.
Solution: hide delegate
16. middle man intermediary
Delegate
17. inappropriate intimacy
Extract method, extract class
18. alternative classes with different interfaces
19. incomplete library class
20. data class
21. refused requests
22. comments
Extract method, Rename method