OO Principle:类应该只有一个改变的理由
OO Pattern:
迭代器模式:提供一种方法顺序访问一个聚合对象中的各个元素,而又不暴露其内部的表示。
组合模式:允许你将对象组成树形结构来表现“整体/部分” 的层次结构。组合能让客户以一致的方式处理个别对
象和组合。
User interface packages often use this pattern for their components: Composite.
We encapsulated this: iteration.
A separate object that can traverse a collection: iterator.
Name of principle that states only one responsibility per class: Single Responsibility.
A class should have only one reason to do this: Change.
This class indirectly supports Iterator: Hashtable.
A composite holds this: Components.
The Iterator Pattern decouples the client from the aggregates implementation.
CompositeIterator used a lot of this:Recursion.
Iterator are usually created using this pattern: Factory method.
A component can be a composite or leaf.
Hashtable and ArrayList both implement this interface: Collection.