
设计模式
busidihuang
这个作者很懒,什么都没留下…
展开
-
单例模式
单例模式(Singleton Pattern)是一个比较简单的模式,其定义如下:Ensure a class has only one instance, and provide a global point of access to it.(确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。)单例模式的使用场景在一个系统中,要求一个类有且仅有一个对象,如果出现多个对象就会出现“不...翻译 2018-06-08 20:49:41 · 151 阅读 · 0 评论 -
责任链模式
责任链模式定义如下:Avoid coupling the sender of a request to its receiver by giving more than one object a chance tohandle the request.Chain the receiving objects and pass the request along the chain until an ...原创 2018-06-08 23:44:33 · 189 阅读 · 0 评论 -
命令模式
命令模式是一个高内聚的模式,其定义为:Encapsulate a request as an object,therebyletting you parameterize clients with different requests,queue or log requests,and support undoableoperations.(将一个请求封装成一个对象,从而让你使用不同的请求把客户端...原创 2018-06-08 23:21:53 · 133 阅读 · 0 评论 -
中介者模式
中介者模式的定义为:Define an object that encapsulates how a set of objectsinteract.Mediator promotes loose coupling by keeping objects from referring to each otherexplicitly,and it lets you vary their interact...原创 2018-06-08 23:06:25 · 129 阅读 · 0 评论 -
原型模式
原型模式(Prototype Pattern)的简单程度仅次于单例模式和迭代器模式。正是由于简单,使用的场景才非常地多,其定义如下:Specify the kinds of objects to create using a prototypical instance,and create new objects bycopying this prototype.(用原型实例指定创建对象的种类,并...转载 2018-06-08 22:51:03 · 125 阅读 · 0 评论 -
建造者模式
建造者模式(Builder Pattern)也叫做生成器模式,其定义如下:Separate the construction of a complex object from its representation so that the sameconstruction process can create different representations.(将一个复杂对象的构建与它的表示分离,...转载 2018-06-08 22:28:13 · 167 阅读 · 0 评论 -
模板方法模式
模板方法模式(Template Method Pattern)是如此简单。其定义如下:Define the skeleton of an algorithm in an operation,deferring some steps to subclasses.TemplateMethod lets subclasses redefine certain steps of an algorithm ...翻译 2018-06-08 22:16:53 · 134 阅读 · 0 评论 -
抽象工厂模式
抽象工厂模式(Abstract Factory Pattern)是一种比较常用的模式,其定义如下:Provide an interface for creating families of related or dependent objects without specifyingtheir concrete classes.(为创建一组相关或相互依赖的对象提供一个接口,而且无须指定它们的具体类...转载 2018-06-08 21:29:07 · 167 阅读 · 0 评论 -
工厂方法模式
工厂方法模式使用的频率非常高,在我们日常的开发中总能见到它的身影。其定义为:Define an interface for creating an object,but let subclasses decide which class toinstantiate.Factory Method lets a class defer instantiation to subclasses.(定义一个...翻译 2018-06-08 21:02:31 · 130 阅读 · 0 评论