# 设计模式原则

- [单一职责原则](https://haoqinn.gitbook.io/handbook-of-design-pattern/she-ji-mo-shi-yuan-ze/dan-yi-zhi-ze-yuan-ze.md): 单一职原则 SRP「Single responsibility principle」：就一个类而言，应该仅有一个引起它变化的原因。修改代码总是一件危险的事情，特别是当两个职责耦合在一起的时候，一个职责发生变化可能会影响到其他职责的实现，造成意想不到的破坏。因此一个对象（方法）只做一件事情
- [最少知识原则](https://haoqinn.gitbook.io/handbook-of-design-pattern/she-ji-mo-shi-yuan-ze/zui-shao-zhi-shi-yuan-ze.md): 最少知识原则 LKP「Least Knowledge Principle」说的是一个软件实体应当尽可能少地与其他实体发生相互作用。这里的软件实体是一个广义的概念，不仅包括对象，还包括系统、类、模块、函数、变量等。
- [开放封闭原则](https://haoqinn.gitbook.io/handbook-of-design-pattern/she-ji-mo-shi-yuan-ze/untitled-4.md): 开放封闭原则 OCP 「Open Closed Principle」, 它的定义如下，软件实体「类、模块、函数」等应该是可以扩展的，但是不可以修改


---

# Agent Instructions: 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:

```
GET https://haoqinn.gitbook.io/handbook-of-design-pattern/she-ji-mo-shi-yuan-ze.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
