Single Responsibility Principle, SRP
Updated 2026-07-30
Summary
In the field of object-oriented programming, the Single Responsibility Principle (SRP) stipulates that each class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All of its (the class's) services should be strictly aligned with that responsibility (aligned meaning no dependencies). The term was coined by Robert Cecil Martin in his book "Agile Software Development, Principles, Patterns, and Practices" in an article titled "Principles of Object-Oriented Design". Martin stated that the principle is based on the cohesion principle from the book "Structured Analysis and System Specification". Martin defined responsibility as "a reason to change", and concluded that a class or module should have one and only one reason to change. If you...
Definition
A module (or class/person) should have one and only one reason to change. That is, it should be responsible for only one thing and do it well. Scaffold use: The power of focus. In team division of labor, do not set up "all-around odd-job" positions. Let each person have only one core KPI. The more singular the responsibility, the clearer the accountability, and the higher the efficiency. Multiple responsibilities inevitably lead to mediocrity and buck-passing.
Introduction
How to use
The power of focus. In team division of labor, do not set up "all-around odd-job" positions. Let each person have only one core KPI. The more singular the responsibility, the clearer the accountability, and the higher the efficiency. Multiple responsibilities inevitably lead to mediocrity and buck-passing.
Mechanism
A module/class/role should assume only one responsibility that causes it to change, making the reason for change singular, reducing coupling, and making it easier to understand and maintain; multiple responsibilities will interfere with each other and cause unexpected modifications.
Practice
In progress 0/4Practice this model in one real situation:
Cases
- A class that handles both data and display → split into model and view; a position is responsible for only one core metric.
Common pitfalls
- Over-splitting leads to fragmentation; treating SRP as "doing only one thing" rather than "one reason to change"; ignoring collaboration costs.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E5%8D%95%E4%B8%80%E5%8A%9F%E8%83%BD%E5%8E%9F%E5%88%99verified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS