一、设计模式的分类
设计模式主要分为三种类型:
1.1 Creational
These design patterns are all about class instantiation or object creation. These patterns can be further categorized into Class-creational patterns and object-creational patterns. While class-creation patterns use inheritance effectively in the instantiation process, object-creation patterns use delegation effectively to get the job done.
Creational design patterns are the Factory Method, Abstract Factory, Builder, Singleton, Object Pool, and Prototype.
1.2 Structural
These design patterns are about organizing different classes and objects to form larger structures and provide new functionality.
Structural design patterns are Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Private Class Data, and Proxy.
1.3 Behavioral
Behavioral patterns are about identifying common communication patterns between objects and realize these patterns.
Behavioral patterns are Chain of responsibility, Command, Interpreter, Iterator, Mediator, Memento, Null Object, Observer, State, Strategy, Template method, Visitor
二、常用的Creational型设计模式
2.1 Singleton(略)
2.2
Refernces:
https://www.geeksforgeeks.org/design-patterns-set-1-introduction/
https://www.geeksforgeeks.org/design-patterns-set-2-factory-method/