go-pattern-examples/README.md

58 lines
2.2 KiB
Markdown
Raw Normal View History

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)
## 姿势
2020-04-22 04:50:47 +03:00
+ 所谓模式就是套路,如功夫,招有定式
+ 这里就是以实际代码示例展示设计模式,通俗易懂
+ 除了常见的23种普适的设计模式,Go也有一些属于自己的模式
2020-04-21 17:50:21 +03:00
## 创建型模式
2020-04-22 04:50:47 +03:00
+ [简单工厂模式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)
2020-04-21 17:50:21 +03:00
## 结构型模式
2020-04-22 04:50:47 +03:00
+ [外观模式Facade](./01_facade)
+ [适配器模式Adapter](./02_adapter)
+ [代理模式Proxy](./09_proxy)
+ [组合模式Composite](./13_composite)
+ [享元模式Flyweight](./18_flyweight)
+ [装饰模式Decorator](./20_decorator)
+ [桥模式Bridge](./22_bridge)
2020-04-21 17:50:21 +03:00
## 行为型模式
2020-04-22 04:50:47 +03:00
+ [中介者模式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)
2020-04-21 17:50:21 +03:00
## Design patters Articles
[GO模式](https://github.com/tmrts/go-patterns)
2020-04-22 04:50:47 +03:00
[参考代码1](https://github.com/tmrts/go-patterns)
[参考代码2](https://github.com/senghoo/golang-design-pattern)
2020-04-23 04:26:32 +03:00
## 更多
需要重新温习下Go基础?看这里
[go-exercise](https://github.com/crazybber/go-exercise)