Bridge Pattern
Decouple an abstraction from its implementation so that the two can vary independently.(将抽象和实现解耦,使得倆者可以独立的变化)
例子
"天下熙熙,皆为利来;天下攘攘,皆为利往" 现实和结构分开
服装公司 ="服装"+"公司" ="服装公司"
解耦之前...
分类:
其他好文 时间:
2015-07-26 12:46:51
阅读次数:
124
策略模式在java集合中的TreeSet和TreeMap中得到了很好的应用,我们可以实现Comparator接口实现Compareto()方法来定义自己的排序规则,然后通过TreeSet,TreeMap构造方法传入实现该接口的实例,map中的顺序就会是我们自定义的顺序。我们可以完全定义自己的规则,用...
分类:
其他好文 时间:
2015-07-25 19:43:26
阅读次数:
191
Observer Pattern
Define a ont-to-many dependency between objects so that when
one object changes state,all its dependents are notified and updated automatically.(定义对象间一种一对多的依赖关系,使得每当一个对象改变状态时,...
分类:
其他好文 时间:
2015-07-25 15:20:55
阅读次数:
129
Facade Pattern
Provide a unified interface to a set of interfaces in a subsystem.Facade defines a higher-level interface that makes the
subsystem easier to use.(要求一个子系统的外部与其内部的通信必须通过一个统一的对象进行,门...
分类:
其他好文 时间:
2015-07-25 15:19:16
阅读次数:
98
Visitor Pattern
Repressent an operation to be performed on the elements of an object structure.Visitor lets you define a new operation without changing the classees of the elements on which it...
分类:
其他好文 时间:
2015-07-25 15:18:41
阅读次数:
109
Mememento Pattern
Without violating encapsulation,capture and externalize an object's internal state so that the object can be restored to
this state later.(在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个...
分类:
其他好文 时间:
2015-07-25 15:18:02
阅读次数:
212
1.Chain of Responsibility模式:将可能处理一个请求的对象链接成一个链,并将请求在这个链上传递,直到有对象处理该请求(可能需要提供一个默认处理所有请求的类,例如MFC中的CwinApp类)。2.Chain of Responsibility Pattern 结构图3.实现 1 ...
分类:
其他好文 时间:
2015-07-24 12:41:43
阅读次数:
98
Future pattern[订单取货模式]一:Future pattern的参与者--->Client(客户需求)--->Host(蛋糕门店)--->Data(票据和蛋糕的接口)--->Future(蛋糕票据)--->ReaData(制作蛋糕过程) 二:Future pattern模式什么时候使用...
分类:
编程语言 时间:
2015-07-23 21:11:20
阅读次数:
135
1.Observer模式要解决的问题为:建立一个一(Subject)对多(Observer)的依赖关系,并且做到当“一”变化的时候,依赖这个“一”的多也能够同步改变.2.Observer Pattern 结构图 注:这里的目标Subject提供依赖于它的观察者Observer的注册(Attach)....
分类:
其他好文 时间:
2015-07-23 13:34:22
阅读次数:
153
public static boolean valMobileNumber(String mobilenumber){ ? ? ? ? ? ?if(StringUtils.isEmpty(mobilenumber)) return false; ? ? ? ? ? ?Pattern p = null; ? ? ? ? ? ? ?Matcher m = n...
分类:
移动开发 时间:
2015-07-23 10:50:32
阅读次数:
158