码迷,mamicode.com
首页 > 其他好文 > 详细

《重构:改善既有代码的设计》重构的方法

时间:2015-07-08 18:13:27      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

Extract Method(110) 将两个类的相同部分提取成函数

Inline Method(117) 内联函数

Replace Temp with Query(120) 将临时变量替代为查询语句 

Replace Method With Method Object(135) 用方法对象替换方法

Substitute Algorithm(139)  代理算法

Move Method(142)  方法在类间移动

Extract Class(149)提炼成类

Hide Delegate(157) 隐藏委托关系

Remove Middle Man(160) 移除中间人

Introduce Foreign Method(162) 引入外加函数

Introduce Local Extension(164) 引入本地扩展

Replace Array with Object (186) 将数组替换为对象

Duplicate Observed Data(189) 重复数据

Change Bidirectional Association to Unidirectional(200)将双向关联改为单向关联

Replace Type Code with Subclass(213) 替换为子类

Replace Type Code with Class(218)替换为类
Replace Type Code with State/Strategy(227)  替换为状态/策略
Decompose Conditional (238) 分解条件
Replace Conditional  with Polymorphism(255) 用多态替代条件语句
Introduce Assertion(267) 引入断言

Preserve Whole Object(288)  

Introduce Parameter Object(295)
Pull up field(320) 将变量提到父类中

Push Down Method(328)  将函数推到子类中

Push Down Field(329) 将变量 推到子类中

Hide Method(303) 隐藏函数

Pull Up Method(332) 将函数提到父类中

Replace Delegation with Inheritance(335)以继承取代委托

Extract Superclass(336) 提炼超类

Form Template Method(345)  形成模板函数

Extract Interface(341) 提取成接口

Replace Inheritance with Delegation(352)以委托取代继承

 

 

《重构:改善既有代码的设计》重构的方法

标签:

原文地址:http://www.cnblogs.com/maxiaodoubao/p/4630734.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!