SOLID Principles Entity Relationships Diagram

  • What This Shows

    • A map of how SOLID principles drive design choices, what artifacts they constrain, and which patterns/tests support or threaten them.
    • Read edges left→right: principle → affected artifact/enabler; patterns support principles; smells violate them.
  • How To Read

    • Start with principles, then trace labeled arrows to artifacts (class/module/interface/abstraction), enablers (DI/composition/tests), patterns, and smells.
    • Prefer extension and composition over modification and inheritance by default.
  • Core Principles (quick map)

    • Single Responsibility Principle: one reason to change → constrains Class; group by reason to change → Module.
    • Open/Closed Principle: extend, don’t modify → Class; plugin-style extension → Module.
    • Liskov Substitution Principle: derived types must substitute → Inheritance; verify with Contract Tests.
    • Interface Segregation Principle: client-specific, minimal Interface → reduces surface for Client.
    • Dependency Inversion Principle: depend on Abstraction, not concretes → wire via DI Container at Composition Root; enables Unit Tests.
  • Structural Glossary

    • Abstraction implemented by Implementation; Client depends on Abstraction; Implementation uses Dependency.
  • Pattern Helpers

    • Strategy pattern → supports OCP; Factory pattern → supplies abstractions for DIP.
    • Adapter pattern → decouples clients for DIP; Facade pattern → centralizes responsibility for SRP.
  • Common Smells (violations)

    • God Object → SRP; Fat Interface → ISP; Tight Coupling → DIP; Fragile Base Class → threatens LSP/OCP.
flowchart TD

%% ========= PRINCIPLES =========

subgraph PRINCIPLES

SRP["SRP — Single Responsibility"]

OCP["OCP — Open/Closed"]

LSP["LSP — Liskov Substitution"]

ISP["ISP — Interface Segregation"]

DIP["DIP — Dependency Inversion"]

end

  

%% ========= CORE ARTIFACTS =========

subgraph CORE_ARTIFACTS[Core artifacts]

CLASS["Class"]

MODULE["Module / Component"]

INTERFACE["Interface"]

ABSTRACTION["Abstraction (interface/abstract class)"]

IMPL["Implementation (concrete class)"]

INHERIT["Inheritance hierarchy"]

CLIENT["Client"]

DEP["Dependency"]

end

  

%% ========= ENABLERS / TESTS =========

subgraph ENABLERS[Enablers / tests]

DI["DI Container"]

CR["Composition Root"]

UT["Unit Tests"]

CT["Contract Tests"]

end

  

%% ========= PATTERNS =========

subgraph PATTERNS

STRAT["Strategy pattern"]

FACT["Factory pattern"]

ADAPT["Adapter pattern"]

FACADE["Facade pattern"]

end

  

%% ========= SMELLS =========

subgraph SMELLS[Common smells]

GOD["God Object"]

FATINT["Fat Interface"]

TIGHT["Tight Coupling"]

FBC["Fragile Base Class"]

end

  

%% ===== PRINCIPLES → ARTIFACTS =====

SRP -->|constrains responsibility of| CLASS

SRP -->|group by reason to change| MODULE

  

OCP -->|prefer extension over change| CLASS

OCP -->|plugin-style extension| MODULE

  

LSP -->|requires substitutability in| INHERIT

LSP -->|verified by| CT

  
DIP -->|depend on| ABSTRACTION

DIP -->|wired by| DI

DIP -->|composed at| CR

DIP -->|enables isolation in| UT



ISP -->|reduces surface area for| CLIENT

ISP -->|split interfaces by client| INTERFACE

  


  

%% ===== STRUCTURAL LINKS =====

ABSTRACTION -->|implemented by| IMPL

CLIENT -->|depends on| ABSTRACTION

IMPL -->|uses| DEP

  

%% ===== PATTERNS SUPPORT =====

STRAT -->|supports| OCP

FACT -->|supplies abstractions for| DIP

ADAPT -->|decouples clients for| DIP

FACADE -->|centralizes responsibility for| SRP

  

%% ===== SMELLS VIOLATE =====

GOD -->|violates| SRP

FATINT -->|violates| ISP

TIGHT -->|violates| DIP

FBC -->|threatens| LSP

FBC -->|threatens| OCP