2018-09-26 20:46:31 +08:00
|
|
|
|
# golang-design-patterns
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
|
|
|
|
## 使用golang实现各种设计模式
|
|
|
|
|
|
2018-11-02 11:58:27 +08:00
|
|
|
|
> golang的最佳实践中并不建议在应用中使用大量的设计模式,望周知
|
|
|
|
|
|
|
|
|
|
> Keep It Simple, Stupid.
|
|
|
|
|
|
2018-09-27 18:09:18 +08:00
|
|
|
|
- 创建型模式
|
|
|
|
|
|
2018-09-27 18:09:58 +08:00
|
|
|
|
1. [单例模式](https://github.com/silsuer/golang-design-patterns/blob/master/singleton/README.md)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
2018-11-02 12:00:10 +08:00
|
|
|
|
2. [简单工厂模式](https://github.com/silsuer/golang-design-patterns/tree/master/simple-factory-pattern)
|
2018-11-02 11:58:27 +08:00
|
|
|
|
|
2018-11-04 19:55:37 +08:00
|
|
|
|
3. [工厂方法模式](https://github.com/silsuer/golang-design-patterns/tree/master/factory-method-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
2018-11-07 11:26:57 +08:00
|
|
|
|
4. [抽象工厂模式](https://github.com/silsuer/golang-design-patterns/tree/master/abstract-factory-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
2018-11-26 16:45:02 +08:00
|
|
|
|
5. [建造者模式](https://github.com/silsuer/golang-design-patterns/tree/master/builder-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
2018-11-26 17:54:52 +08:00
|
|
|
|
6. [原型模式](https://github.com/silsuer/golang-design-patterns/tree/master/prototype-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
|
|
|
|
- 行为型模式
|
|
|
|
|
|
2018-11-30 12:36:36 +08:00
|
|
|
|
1. [访问者模式](https://github.com/silsuer/golang-design-patterns/tree/master/visitor-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
2018-12-01 12:11:14 +08:00
|
|
|
|
2. [模板模式](https://github.com/silsuer/golang-design-patterns/tree/master/template-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
2019-02-11 10:16:02 +08:00
|
|
|
|
3. [策略模式](https://github.com/silsuer/golang-design-patterns/tree/master/strategy-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
|
|
|
|
4. 状态模式
|
|
|
|
|
|
2018-12-03 13:55:41 +08:00
|
|
|
|
5. [观察者模式](https://github.com/silsuer/golang-design-patterns/tree/master/observer-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
2018-12-05 12:04:37 +08:00
|
|
|
|
6. [备忘录模式](https://github.com/silsuer/golang-design-patterns/tree/master/memento-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
2018-12-06 12:24:06 +08:00
|
|
|
|
7. [中介者模式](https://github.com/silsuer/golang-design-patterns/tree/master/mediator-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
2018-12-07 13:34:59 +08:00
|
|
|
|
8. [迭代器模式](https://github.com/silsuer/golang-design-patterns/tree/master/iterator-pattern)
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
|
|
|
|
9. 解释器模式
|
|
|
|
|
|
|
|
|
|
10. 命令模式
|
|
|
|
|
|
|
|
|
|
11. 责任链模式
|
|
|
|
|
|
|
|
|
|
- 结构型模式
|
|
|
|
|
|
|
|
|
|
1. 适配器模式
|
|
|
|
|
|
|
|
|
|
2. 桥接模式
|
|
|
|
|
|
|
|
|
|
3. 组合模式
|
|
|
|
|
|
|
|
|
|
4. 装饰模式
|
|
|
|
|
|
|
|
|
|
5. 外观模式
|
|
|
|
|
|
2019-02-11 10:18:54 +08:00
|
|
|
|
6. 享元模式
|
2018-09-27 18:09:18 +08:00
|
|
|
|
|
|
|
|
|
7. 代理模式
|