《设计模式解析》 第17章 Decorate模式 复习题

来源:互联网 发布:ubuntu 移除ppa 编辑:程序博客网 时间:2024/05/21 08:01
《设计模式解析》 第17章 Decorate模式 复习题


Review Questions
Observations
1: What does each Decorator object wrap?
Decorator对象封装的是需要进行功能扩展的组件,该组件与decorator实现了相同的接口或继承了相同的抽象类。
2: What are two classic examples of decorators?
Java 的I/O流。
UI界面添加功能。
Interpretations
1: How does the Decorator pattern help to decompose the problem?
将功能链的动态构建和使用功能的客户分离开来。

2: "The structure is not the pattern." This statement is made during the discussion of the essence of the Decorator pattern. What does this mean? Why is this important?


Opinions and Applications
1: Why do you think the Gang of Four call this pattern "Decorator"? Is it an appropriate name for what it is doing? Why or why not?
挺好的,装饰者,为一个已存在的事物添加一些额外的特性,使之有更强的功能特性。
2: Sometimes people think of patterns as recipes. What is wrong with this?
模式,只有在真正了解了他,并且清楚了他的作用以及适用情况的时候,才能够为问题服务。但并不是所有的问题都能够用模式解决的。

原创粉丝点击