There are three main types of design patterns: creational, structural and behavioral

There are three main types of design patterns: creational, structural and behavioral. 

 

Creation types are: 

1. Singleton, singleton pattern: guarantees that a class has only one instance and provides a global access point to access it 

Two, two, Abstract Factory, Abstract Factory: Provides an interface to create a series of related or interdependent objects without specifying their specific classes. 

Three, three, Factory Method, factory method: define an interface for creating objects, let subclasses decide which class to instantiate, Factory Method delays the instantiation of a class to subclasses.

4. Builder, construction mode: separates the construction of a complex object from its representation, so that the same construction process can create different representations. 

Five, five, Prototype, prototype mode: use prototype instances to specify the types of objects to be created, and create new objects by copying these prototypes. 

Behavioral types are: 

Six, six, Iterator, iterator pattern: Provides a method to sequentially access the elements of an aggregate object without exposing the internal representation of the object. 

Seven, seven, Observer, Observer mode: Define a one-to-many dependency relationship between objects. When the state of an object changes, all objects that depend on it are notified and automatically updated. 

Eight, eight, Template Method, template method: define the skeleton of an algorithm in an operation, and delay some steps to subclasses, TemplateMethod allows subclasses to redefine an algorithm without changing the structure of the algorithm to obtain some specific step. 

Nine, nine, Command, command mode: encapsulates a request as an object, allowing you to parameterize clients with different requests, queue and log requests, and support undoable operations. 

Ten, ten, State, state mode: allows an object to change his behavior when its internal state changes. The object seems to have changed his class. 

Eleven, Eleven, Strategy, strategy mode: define a series of algorithms, encapsulate them one by one, and make them replaceable with each other. This mode makes the algorithms independent of the customers who use them. 

Twelve, Twelve, China of Responsibility, responsibility chain mode: enable multiple objects to have the opportunity to process the request, thereby avoiding the coupling relationship between the sender and receiver of the request 

十三、十三、Mediator,中介者模式:用一个中介对象封装一些列的对象交互。 

十四、十四、Visitor,访问者模式:表示一个作用于某对象结构中的各元素的操作,它使你可以在不改变各元素类的前提下定义作用于这个元素的新操作。

十五、 十五、Interpreter,解释器模式:给定一个语言,定义他的文法的一个表示,并定义一个解释器,这个解释器使用该表示来解释语言中的句子。 

十六、十六、Memento,备忘录模式:在不破坏对象的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。 

结构型有: 

十七、十七、Composite,组合模式:将对象组合成树形结构以表示部分整体的关系,Composite使得用户对单个对象和组合对象的使用具有一致性。 

十八、十八、Facade,外观模式:为子系统中的一组接口提供一致的界面,facade提供了一高层接口,这个接口使得子系统更容易使用。 

十九、十九、Proxy,代理模式:为其他对象提供一种代理以控制对这个对象的访问 

二十、二十、Adapter,适配器模式:将一类的接口转换成客户希望的另外一个接口,Adapter模式使得原本由于接口不兼容而不能一起工作那些类可以一起工作。 

二十一、二十一、Decrator,装饰模式:动态地给一个对象增加一些额外的职责,就增加的功能来说,Decorator模式相比生成子类更加灵活。 

二十二、二十二、Bridge,桥模式:将抽象部分与它的实现部分相分离,使他们可以独立的变化。 

二十三、二十三、Flyweight,享元模式

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326596214&siteId=291194637