重构的手段

  1. Extract Method 提取函数

 

 

 

 

 

  1. Replace Temp with Query 以查询取代临时变量

 

 

 

 

 

  1. Introduce Parameter Object 引入参数对象

 

  1. Preserve Whole Object 保持对象完整

 

  1. Replace Method with Method Object 以函数对象取代函数

 

 

 

  1. Decompse Conditional 分解条件表达式

 

 

  1. Extract Class 提炼类

 

  1. Extract Subclass 提炼子类

  1. Inline Class 将类内联化

 

 

  1. Extract Interface 提炼接口

 

  1. Duplicate Observed Data 复制"监视数据"

 

  1. Rename Method 函数改名

 

  1. Introduce Assertion 引入断言

 

 

  1. Collapse Hierarchy 折叠继承体系

 

  1. Remove Parameter 移除参数

 

  1. Remove Method 移除函数

 

 

  1. Pull UP Method 函数上移

 

  1. Form Template Method 塑造模板函数

 

  1. Move Method 搬移函数

 

 

  1. Extract Superclass 提炼超类

 

  1. Replace Conditional with Polymorphism 以多态取代条件表达式

D

 

 

 

  1. Replace Type Code with Subclass 以子类取代类型码

 

  1. Replace Type Code with State/Strategy 以State/Strategy 取代类型码

 

  1. Replace Parameter with Explicit Methods 以明确函数取代参数

 

 

  1. Introduce Null Object 引入Null对象

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值