SOLID-Single Responsibility Principle
Details
- Full Name
-
SOLID Single Responsibility Principle (SRP)
Intent:
A class should have only one reason to change. Each module or class should be responsible for a single part of the software’s functionality.
When to Use:
-
A class has multiple unrelated responsibilities
-
Changes to one feature require modifying unrelated code
-
Unit testing requires complex setup due to tangled concerns
Prompt Example:
"Refactore diese Klasse nach dem SOLID-Single Responsibility Principle. Trenne die Verantwortlichkeiten in separate Klassen."
Related Anchors:
-
SOLID Principles (Umbrella)