Clean Architecture
Details
- Full Name
-
Clean Architecture according to Robert C. Martin
Core Concepts:
- The Dependency Rule
-
Dependencies only point inward
- Concentric circles
-
Entities → Use Cases → Interface Adapters → Frameworks & Drivers
- Independent of frameworks
-
Architecture doesn’t depend on libraries
- Testable
-
Business rules testable without UI, database, or external elements
- Independent of UI
-
UI can change without changing business rules
- Independent of database
-
Business rules not bound to database
- Independent of external agencies
-
Business rules don’t know about outside world
- Screaming Architecture
-
Architecture reveals the intent of the system
- SOLID principles
-
Foundation of the architecture
- Key Proponent
-
Robert C. Martin ("Uncle Bob")
When to Use:
-
Enterprise applications with complex business logic
-
Systems requiring long-term maintainability
-
When team size and turnover are high
-
Projects where business rules must be protected from technology changes
Criticism:
-
Jimmy Bogard, "Vertical Slice Architecture" (2018) — calls the "traditional layered/onion/clean architecture" monolithic in its approach and appropriate for only a minority of requests, criticizing mock-heavy tests and abstractions "around concepts that really shouldn’t be abstracted"; his alternative is Vertical Slice Architecture
-
Derek Comartin, "'Clean Architecture' and indirection. No thanks." (CodeOpinion) — dismisses canonical Clean Architecture examples as "useless indirection": the layering adds cost without paying for itself in typical systems
-
The critiques converge: the dependency rule imposes a fixed indirection tax on every feature, while most changes cut across all layers anyway — the coupling Vertical Slice Architecture organizes around instead