![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Refactoring
Twent
这个作者很懒,什么都没留下…
展开
-
Bad Smells in Codes
1. Duplicated Code(重复代码)现象:重复代码是最常见的Bad Smells. 如果在程序中多次出现重复的代码结构,就应该设法去重构它们。策略:相同的类的重复代码通过Extract Method方法进行重构;在不同Subclasses中:通过Extract Method提炼出重复的代码,然后通过Pull Up Method将该方法移动到上级的Super class内;在没有关系的C原创 2005-06-27 17:36:00 · 1951 阅读 · 0 评论 -
Refactor To Pattern(一)
1 Chain Constructors Chain the constructors together to obtain the least duplicate code when you have multiple constructors that contain duplicate code 现象:一个类中的多个构造函数含有相同的代码将会引起不必要的麻烦,当需要增加一个变量初始原创 2005-07-01 14:50:00 · 1829 阅读 · 0 评论