2020-04-21 17:58:50 +03:00
|
|
|
|
# Go 语言设计模式示例集合
|
2020-04-21 17:50:21 +03:00
|
|
|
|
|
|
|
|
|
参考资料:[大话设计模式](https://book.douban.com/subject/2334288/) | [图解设计模式](https://book.douban.com/subject/26933281/) | [菜鸟教程—设计模式](https://www.runoob.com/design-pattern/design-pattern-tutorial.html)
|
|
|
|
|
|
|
|
|
|
[![Build Status](https://travis-ci.org/senghoo/golang-design-pattern.svg?branch=master)](https://travis-ci.org/senghoo/golang-design-pattern)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 姿势
|
|
|
|
|
|
|
|
|
|
以实际代码示例展示设计模式
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 创建型模式
|
|
|
|
|
|
|
|
|
|
* [简单工厂模式(Simple Factory)](./creation/00_simple_factory)
|
|
|
|
|
* [工厂方法模式(Factory Method)](./creation/04_factory_method)
|
|
|
|
|
* [抽象工厂模式(Abstract Factory)](./creation/05_abstract_factory)
|
|
|
|
|
* [创建者模式(Builder)](./creation/06_builder)
|
|
|
|
|
* [原型模式(Prototype)](./creation/07_prototype)
|
|
|
|
|
* [单例模式(Singleton)](./creation/03_singleton)
|
|
|
|
|
|
|
|
|
|
## 结构型模式
|
|
|
|
|
|
|
|
|
|
* [外观模式(Facade)](./01_facade)
|
|
|
|
|
* [适配器模式(Adapter)](./02_adapter)
|
|
|
|
|
* [代理模式(Proxy)](./09_proxy)
|
|
|
|
|
* [组合模式(Composite)](./13_composite)
|
|
|
|
|
* [享元模式(Flyweight)](./18_flyweight)
|
|
|
|
|
* [装饰模式(Decorator)](./20_decorator)
|
|
|
|
|
* [桥模式(Bridge)](./22_bridge)
|
|
|
|
|
|
|
|
|
|
## 行为型模式
|
|
|
|
|
|
|
|
|
|
* [中介者模式(Mediator)](./08_mediator)
|
|
|
|
|
* [观察者模式(Observer)](./10_observer)
|
|
|
|
|
* [命令模式(Command)](./11_command)
|
|
|
|
|
* [迭代器模式(Iterator)](./12_iterator)
|
|
|
|
|
* [模板方法模式(Template Method)](./14_template_method)
|
|
|
|
|
* [策略模式(Strategy)](./15_strategy)
|
|
|
|
|
* [状态模式(State)](./16_state)
|
|
|
|
|
* [备忘录模式(Memento)](./17_memento)
|
|
|
|
|
* [解释器模式(Interpreter)](./19_interpreter)
|
|
|
|
|
* [职责链模式(Chain of Responsibility)](./21_chain_of_responsibility)
|
|
|
|
|
* [访问者模式(Visitor)](./23_visitor)
|
|
|
|
|
|
|
|
|
|
## Design patters Articles
|
|
|
|
|
|
|
|
|
|
[GO模式](https://github.com/tmrts/go-patterns)
|
|
|
|
|
|
|
|
|
|
[本设计模式的原始代码](https://github.com/senghoo/golang-design-pattern)
|