Simplicity is the essence of happiness. - Cedric Bledsoe
违反捕获使具体化恢复这种模式在不破坏封装性的前提下捕获和具体化对象的内部状态以便对象可以恢复最后的状态 Caretaker(看管者) This class is responsible for the memento's safekeeping while never operating on or examining(检查) the contents of a memento. (这个类是负责备忘录的保护,而从来没有操作或检查备忘录的内容。) Memento(备忘录) This class stores internal state of the Originator(起源) object and protects against(反对) access by objects other than the originator. (这类存储发起人对象的内部状态和防止除了发起人之外的对象访问。) Originator(起源) This class creates a memento containing a snapshot(快...
发布于 5 years ago
27873
这种模式使用一个原型的实例指定创建对象的种类并通过复制这个原型创建新对象 Client(客户端) This class creates a new object by asking a prototype to clone itself. (这个类创建一个新的对象通过访问一个原型来克隆自身。) ConcretePrototype2(具体原型2) This class implements an operation for cloning itself. (这个类实现了一个操作,用于克隆本身。) ConcretePrototype1(具体原型1) This class implements an operation for cloning itself. (这个类实现了一个操作,用于克隆本身。) Prototype(原型) This class declares an interface for cloning itself. (这类声明一个接口用于克隆本身。) 代码实现 <?php...
发布于 5 years ago
26508
这种模式确保一个类只有一个实例并提供一个访问它的全局访问点 Singleton This class (a) defines an Instance operation that lets clients access its unique instance, and (b) may be responsible for creating its own unique instance. (这类(a)定义了一个实例操作,允许客户访问其独特的实例,和(b)可能是负责创建自己唯一的实例。) 代码实现 <?php class Singleton { static private $_instance = null; private function __construct() { } static public function getInstance() { if (is_null(self::$_instance)) { self::$_inst...
发布于 5 years ago
27580
提供一个集中的请求处理机制 -. Front Controller -. 前端控制器 -. Dispatcher -. 调度器 -. 调度请求到相应的具体处理程序 -. View -. 视图 -. 为请求而创建的对象 代码实现 <?php
发布于 5 years ago
25820
代理这种模式提供了一个代理或占位符为另一个对象来控制对它的访问 Proxy(代理) This class (a) maintains a reference that lets the proxy access the real subject, (b) provides an interface identical(完全相同的) to Subject's so that a proxy can be substituted(['sʌbstitju:tid] 代替) for the real subject, and (c) controls access to the real subject and may be responsible for creating and deleting it. (这类(a)维护一个引用,让代理访问真正的主题,(b)给主题提供一个完全相同的接口,让一个代理可以代替真正的主题,和(c)控制访问真正的主题,能够负责创建和删除它。) RealSubject(真对象) This class defines the...
发布于 5 years ago
27600
细粒的有效地这个模式有效地使用共享来支持大量的细粒度对象 Client(客户端) This class (a) maintains a reference to a flyweight, and (b) computes or stores the extrinsic([ek'strinsik] 外在地) state of flyweight(s). (这类(a)维护一个轻量级选手的引用,和(b)计算或存储轻量级选手的外在的状态。) UnsharedConcreteFlyweight(不共享具体享元) Not all Flyweight subclasses need to be shared. The Flyweight interface enables sharing; it doesn't enforce it. (并不是所有的轻量级选手子类需要共享。Flyweight接口允许共享;它不强制它。) ConcreteFlyweight(具体享元) This class implements the Flyweight i...
发布于 5 years ago
27400
封装交互促进松散耦合明确的独立地这种模式定义了一个对象该对象封装了一组对象如何交互中介者使各对象不需要显式地相互引用从而使其耦合松散它允许你独立的改变他们的交互 ConcreteColleague(['kɔli:ɡ] 同事)2 Each colleague class knows its mediator object and communicates(沟通) with its mediator whenever it would have otherwise communicated with another colleague. (每个同事类知道它的中介对象和与每当它本来与另一位同事沟通都通过与中介沟通来传达。) ConcreteColleague(['kɔli:ɡ] 同事)1 Each colleague class knows its mediator object and communicates(沟通) with its mediator whenever it would have otherwise communicated w...
发布于 5 years ago
29713
心血来潮,写个h5宣传demo, 请在手机里浏览 http://edvery.com/projects/h5/static/newyear2.min.html
发布于 5 years ago
345416