NOTE

Single Responsibility Principle

What the single responsibility principle is, why it is needed, and how to separate different responsibilities into different classes or modules.

Software Architecture & EngineeringCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What Is the Single Responsibility Principle?

A class should do only one thing; an implementation class should have a single responsibility.

2. Why Is the Single Responsibility Principle Needed?

Improve code readability.

3. Implementing the Single Responsibility Principle

The designer needs to identify the different responsibilities of a class, separate them, and then encapsulate them in different classes or modules.

4. References

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub