/*
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. Shortgun surgery 霰彈修改; 和發散式變化正相反
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 依戀情結
symptom: a method use a lot of method in another class.
Move method, Strategy, Visitor pattern
8. Data clumps 數據泥團
9. Primitive obsession 基本類型偏執
Replace data value with object, replace type code with class
10. Switch statements : switch 驚悚現身
Replace conditional with polymorphism
11. Parallel inheritance hierarchies 平行繼承體系
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冗贅類
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 誇誇其談未來性
remove parameter, collapse hierarchy, inline class
14. temporary field 暫時字段
extract class, introduce nullable object
15. message chains過度耦合的信息鏈
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 another object, and so on.
solution: hide delegate
16. middle man 中間人
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