《设计模式解析》 第19章 Observer 模式 复习题
来源:互联网 发布:php获取js变量 编辑:程序博客网 时间:2024/05/17 23:16
Review Questions
Observation
1:The Template Method pattern makes the method call in a special way. What is that?
将方法的调用延迟到派生类中。
Interpretation
1:According to the Gang of Four, the intent of the Template Method pattern is to "define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Redefine the steps in an algorithm without changing the algorithm's structure." What does this mean?
定义各个方法以及方法调用的顺序,而对于某些方法的实现,则让派生类去实现。这样,派生类可以根据自己的需要对这些方法进行定义,而不会影响到父类。
2:The Gang of Four calls this a "Template Method." Why do they do this?
他定义了一个方法实现的模板,将各个方法的调用顺序都给出了,我们需要做的仅是根据自己的需要在派生类中实现这些方法的具体细节。
3:What is the difference between the Strategy pattern (Chapter 9) and the Template Method pattern?
模板方法是改变算法的一部分。
策略模式是使用委托改变整个算法。
- 《设计模式解析》 第19章 Observer 模式 复习题
- 《设计模式解析》 第18章 Observer 模式 复习题
- 《设计模式解析》第5章 设计模式简介 复习题
- 《设计模式解析》 第6章 Facade模式 复习题
- 《设计模式解析》 第7章 Adapter模式 复习题
- 《设计模式解析》 第9章 Strategy模式 复习题
- 《设计模式解析》 第10章 Bridge模式 复习题
- 《设计模式解析》 第11章 Abstract Factory 模式 复习题
- 《设计模式解析》 第17章 Decorate模式 复习题
- 《设计模式解析》 第23章 Factory Method 模式 复习题
- 《设计模式解析》 第8章 开拓视野 复习题
- 《设计模式解析》 第16章 分析矩阵 复习题
- 《设计模式解析》 第14章 设计模式的原则与策略 复习题
- 《设计模式解析》 第13章 用模式解决CADCAM问题 复习题
- 《设计模式解析》 第12章 专家设计之道 复习题
- 《设计模式解析》 第15章 共性与可变性分析 复习题
- 设计模式:Observer模式
- 设计模式-Observer 模式
- 数据库之事务
- Huffman - coding with matlab
- 获得Windows Phone开发职位的要求
- mount NFS
- Linux kernel内核中的atoi,itoa等函数 .
- 《设计模式解析》 第19章 Observer 模式 复习题
- SSH使用指南
- Oracle 时间差计算
- 10.windbg-r
- ios 简单的图片缩放方法
- 黑马程序员_GUI的学习日记
- [Android] setContentView和inflater区别以及findViewById和inflater的区别
- db2修改用户密码
- mysql乱码:字符集问题