Definition
- For a class, there should be only one reason for its change
Inference 1 (basic)
- A class should include the most basic and unchangeable core implementation, which is the core value of the class.
- Core Value: different from the basic features of other classes, or the basic functions that classes should implement
Inference 1 (Extension)
- When changes reach the core implementation of a class, they must be replaced rather than modified.
Inference 2
- For a class, only the things that can be decided by the class should be left to the user for decision-making.
Inference 3
- Include the things that can be determined in the core implementation.
- Choose the most common decision that cannot be determined by yourself as the default extension.
- Remove things that cannot be decided at all.
What I think when I look at a single responsibility principle. These theoretical books seem dull, but the more interesting they are.