1995年,Erich Gamma、Richard Helm、Ralph Johnson 和 John Vlissides 四人合著出版了《Design Patterns: Elements of Reusable Object-Oriented Software》,将设计模式引入软件工程领域。这四位作者被称为 Gang of Four,因此这本书也被称为 GoF。
设计模式属于软件开发的基础知识,在 GoF 一书中列举了 23 种设计模式,分类为创建型模式、结构型模式以及行为模式。本系列文章借助 Java 语言对现有的设计模式进行说明和演示。
创建型模式
抽象工厂(Abstract Factory)
生成器(Builder)
原型(Prototype)
结构型模式
适配器(Adapter)
桥接(Bridge)
组合(Composite)
装饰者(Decorator)
外观(Facade)
享元(Flyweight)
代理(Proxy)
行为模式
责任链(Chain of Responsibility)
命令(Command)
解释器(Interpreter)
迭代器(Iterator)
中介者(Mediator)
备忘录(Memento)
观察者(Observer)
状态(State)
策略(Strategy)
模板方法(Template Method)
访问者(Visitor)