Files
nexus/wiki/concepts/单一职责.md
2026-04-17 08:38:12 +08:00

23 lines
511 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "单一职责"
type: concept
tags: []
---
## Definition
每个文件、每个类、每个函数应只负责一件事。这是软件设计的基本原则之一。
## Key Points
- 一个函数只处理一个任务
- 提炼公共逻辑避免重复代码DRY
- 模块化、函数化,提高复用价值
- 明确区分输入 → 处理 → 输出
## Source
- [[kai-fa-jing-yan-yu-xiang-mu-gui-fan-zheng-li-wen-dang]]
## Related Concepts
- [[DRY 原则]]
- [[模块化]]
- [[函数式编程]]