重构之路第五篇——简化函数调用

目录:

1 Rename Method(函数改名)

2 Add Parameter(添加参数)

3 Remove Parameter(移除参数)

4 Separate Query from Modifier(将查询函数和修改函数分离)

5 Parameterize Method(令函数携带参数)

6 Replace parameter with Explicit Methods(以明确函数取代参数)

7 Preserve Whole Object(保持完整对象)

8 Replace Parameter with Methods(以函数取代参数)

9 Introduce Parameter Object(引入参数对象)

10 Remove Setting Method(移除设值函数)

11 Hide Method(隐藏函数)

12 Replace Constructor with Factory Method(以工厂函数取代构造函数)

13 Encapsulate Downcast(封装向下转型)

14 Replace Error Code with Exception(以异常取代错误代码)

15 Replace Exception with Test(以测试取代异常)

原文地址:https://www.cnblogs.com/cs-forget/p/7709397.html