Interface Segregation Principle (EN)

Concept

Principle stating that clients should not depend on interfaces they do not use

Architecture

flowchart LR   subgraph ClientA     A1[Client A]   end   subgraph ClientB     B1[Client B]   end   subgraph Interface     I1[Interface 1] -->|Methods 1-3| A1     I2[Interface 2] -->|Methods 2-4| B1     I3[Interface 3] -->|Methods 1,4| A1     I3 -->|Methods 1,4| B1   end   subgraph Service     S1[Service with Interface 1]     S2[Service with Interface 2]     S3[Service with Interface 3]   end   A1 --> I1   A1 --> I3   B1 --> I2   B1 --> I3 

In Context

  • Typically used together with the other SOLID principles
  • Related to: Single Responsibility Principle, Dependency Inversion
  • Example use case: Avoiding "Fat Interfaces" in API designs
Quelle: AI Generated