> For the complete documentation index, see [llms.txt](https://innofang.gitbook.io/oh-my-design-patterns/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://innofang.gitbook.io/oh-my-design-patterns/gitbook/undefined.md).

# Oh, my design patterns

一本关于设计模式的电子书，记录了我学习设计模式时写的文章以及代码。若有纰漏，欢迎指正与交流。😀

👉 [点击查看源码](https://github.com/InnoFang/oh-my-design-patterns/tree/master)

## 目录

* [创建型（Creational）](https://github.com/InnoFang/oh-my-design-patterns/tree/26a29a19a0139b4a0d8ebaeb13a85d5caa9fe630/创建型（Creational）/README.md)
  * [工厂方法模式](/oh-my-design-patterns/gitbook/chuang-jian-xing-creational/1.-gong-chang-fang-fa-mo-shi.md)
  * [抽象工厂模式](/oh-my-design-patterns/gitbook/chuang-jian-xing-creational/2.-chou-xiang-gong-chang-mo-shi.md)
  * [建造者模式](/oh-my-design-patterns/gitbook/chuang-jian-xing-creational/3.-jian-zao-zhe-mo-shi.md)
  * [原型模式](/oh-my-design-patterns/gitbook/chuang-jian-xing-creational/4.-yuan-xing-mo-shi.md)
  * [单例模式](/oh-my-design-patterns/gitbook/chuang-jian-xing-creational/5.-dan-li-mo-shi.md)
* [结构型（Structural）](https://github.com/InnoFang/oh-my-design-patterns/tree/26a29a19a0139b4a0d8ebaeb13a85d5caa9fe630/结构型（Structural）/README.md)
  * [适配器模式](/oh-my-design-patterns/gitbook/jie-gou-xing-structural/1.-shi-pei-qi-mo-shi.md)
  * [装饰模式](/oh-my-design-patterns/gitbook/jie-gou-xing-structural/2.-zhuang-shi-mo-shi.md)
  * [外观模式](/oh-my-design-patterns/gitbook/jie-gou-xing-structural/3.-wai-guan-mo-shi.md)
  * [享元模式](/oh-my-design-patterns/gitbook/jie-gou-xing-structural/4.-xiang-yuan-mo-shi.md)
  * [代理模式](/oh-my-design-patterns/gitbook/jie-gou-xing-structural/5.-dai-li-mo-shi.md)
* [行为型（Behavioral）](https://github.com/InnoFang/oh-my-design-patterns/tree/26a29a19a0139b4a0d8ebaeb13a85d5caa9fe630/行为型（Behavioral）/README.md)
  * [模板方法模式](/oh-my-design-patterns/gitbook/hang-wei-xing-behavioral/1.-mo-ban-fang-fa-mo-shi.md)
  * [责任链模式](/oh-my-design-patterns/gitbook/hang-wei-xing-behavioral/2.-ze-ren-lian-mo-shi.md)
  * [迭代器模式](/oh-my-design-patterns/gitbook/hang-wei-xing-behavioral/3.-die-dai-qi-mo-shi.md)
  * [备忘录模式](/oh-my-design-patterns/gitbook/hang-wei-xing-behavioral/4.-bei-wang-lu-mo-shi.md)
  * [观察者模式](/oh-my-design-patterns/gitbook/hang-wei-xing-behavioral/5.-guan-cha-zhe-mo-shi.md)
  * [状态模式](/oh-my-design-patterns/gitbook/hang-wei-xing-behavioral/6.-zhuang-tai-mo-shi.md)
  * [策略模式](/oh-my-design-patterns/gitbook/hang-wei-xing-behavioral/7.-ce-lve-mo-shi.md)
  * [访问者模式](/oh-my-design-patterns/gitbook/hang-wei-xing-behavioral/8.-fang-wen-zhe-mo-shi.md)

## License

[![Creative Commons License](https://i.creativecommons.org/l/by-nc/4.0/88x31.png)](http://creativecommons.org/licenses/by-nc/4.0/)\
This work is licensed under a [Creative Commons Attribution-NonCommercial 4.0 International License](http://creativecommons.org/licenses/by-nc/4.0/).

本作品采用[知识共享署名-非商业性使用 4.0 国际许可协议](http://creativecommons.org/licenses/by-nc/4.0/)进行许可。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://innofang.gitbook.io/oh-my-design-patterns/gitbook/undefined.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
