Mapper:在两个独立的对象(系统)之间建立通信的对象。
使用场景:
Mapper主要的作用在于见系统的不同部分解耦,只有确保没有任何一方子系统依赖于子系统之间交互时,才应使用Mapper。最常用的Mapper就是数据映射器了。
与Gof模式的区别:
在隔离不同部件的用途方面,类似于Mediator(调停者)。使用调停的多个对象互相不认识,但知道Mediator的存在;而Mapper隔离的对象就不知道Mapper的存在(图中的箭头不是双向的)。
Layer Supertype:充当某一层中所有类型的超类型。
使用场景:
当软件某一层中所有对象有公共特性时就可以使用Layer Supertype。
与Gof模式的区别:
大家一看应该就知道和Template模式类似,这里应该是Template模式的子集,Layer Supertype,重点在于体现在Layer中的解决方案。而Template则比较泛,Template模式简单的说就是继承。
例如:领域对象,还有基类Object(把所有类都比做Layer里的对象)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
这个类就为领域对象统一提供了ID支持。