了解设计模式的意图,是在代码重构中浮现并识别设计模式的关键。 本文将四巨头在《设计模式》一书的23种设计模式的意图放在一个页面里,方便查阅。四巨头把这23种设计模式按照创建、结构、行为分为三类。
Abstract Factory抽象工厂
Builder建造者
Factory Method工厂方法
Prototype原型
Singleton单例
Adapter适配器
Bridge桥接
Composite组合
Decorator装饰器
Facade门面
Flyweight轻量级
Proxy代理
Chain of Responsibility责任链
Command命令
Interpreter翻译者
Iterator迭代器
Mediator中介者
Memento纪念品
Observer观察者
State状态
Strategy策略
Template Method模板方法
Visitor访问者