重构的手段

  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对象

猜你喜欢

转载自www.cnblogs.com/kexinxin/p/10011961.html