每一个设计模式的基本套路都是这样的:
- 适用场景, 说出几个实际使用的例子, 帮助你了解这大概是个啥
- In JAVA 这部分会给出这个设计模JAVA中的基本样子, 感觉从JAVA来理解能更加方便
- 优缺点
- In JS 在JS中这个设计模式的写法
- Creational 创建对象
- Singleton 只拥有一个对象
- Prototype
- Simple Factory
- Factory
- Abstract Factory
- Builder
- Structural 把类和对象组合到更大的结构中
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
- Behavioral 类和对象如何交配职责
- Chain of Responsiblity
- Command
- Lterator
- Mediator
- Memeto
- Observer
- Visitor
- Strategy
- State
- Template Method