Single Responsibility Principle (EN)

Concept

Principle stating that a class should have only one reason to change

Architecture

classDiagram   class KlasseA {     +methodeA()     +attributA   }   class KlasseB {     +methodeB()     +attributB   }   class KlasseC {     +methodeC()     +attributC   }   KlasseA : Responsibility 1   KlasseB : Responsibility 2   KlasseC : Responsibility 3 

In Context

  • Typically used together with Open/Closed Principle, Liskov Substitution Principle
  • Related to: Separation of Concerns, High Cohesion, Low Coupling
  • Example use: Separation of database access, business logic, and user interface into separate classes
Quelle: AI Generated