Skip to main content

Clean Architecture: A Craftsman's Guide to Software Structure and Design

"The only way to go fast, is to go well." β€” Robert C. Martin

About This Book​

Clean Architecture (2017, Prentice Hall) by Robert C. Martin ("Uncle Bob") is one of the most influential books in modern software engineering. It synthesizes decades of lessons from software development into a coherent philosophy: that good architecture minimizes the human effort required to build and maintain systems.

This isn't just another patterns book. It is a principled argument for how to structure software so that it stays flexible, testable, and maintainable over its entire lifetime β€” from the first commit to years of production evolution.


Who Should Read This​

AudienceWhat They'll Get
Junior / Mid-level developersA foundational mental model for writing code that scales
Senior engineersLanguage to articulate and defend architectural decisions
Tech leads / architectsA complete philosophy to guide team structure and system design
Java / Spring developersConcrete patterns directly applicable to layered Spring applications

Book Structure at a Glance​

The book is organized into six parts plus appendices, progressing from the smallest unit of code to the largest architectural concerns:

Clean Architecture
β”‚
β”œβ”€β”€ Part I β€” Introduction
β”‚ β”œβ”€β”€ Chapter 1: What Is Design and Architecture?
β”‚ └── Chapter 2: A Tale of Two Values
β”‚
β”œβ”€β”€ Part II β€” Programming Paradigms
β”‚ β”œβ”€β”€ Chapter 3: Paradigm Overview
β”‚ β”œβ”€β”€ Chapter 4: Structured Programming
β”‚ β”œβ”€β”€ Chapter 5: Object-Oriented Programming
β”‚ └── Chapter 6: Functional Programming
β”‚
β”œβ”€β”€ Part III β€” Design Principles (SOLID)
β”‚ β”œβ”€β”€ Chapter 7: SRP β€” Single Responsibility Principle
β”‚ β”œβ”€β”€ Chapter 8: OCP β€” Open-Closed Principle
β”‚ β”œβ”€β”€ Chapter 9: LSP β€” Liskov Substitution Principle
β”‚ β”œβ”€β”€ Chapter 10: ISP β€” Interface Segregation Principle
β”‚ └── Chapter 11: DIP β€” Dependency Inversion Principle
β”‚
β”œβ”€β”€ Part IV β€” Component Principles
β”‚ β”œβ”€β”€ Chapter 12: Components
β”‚ β”œβ”€β”€ Chapter 13: Component Cohesion
β”‚ └── Chapter 14: Component Coupling
β”‚
β”œβ”€β”€ Part V β€” Architecture
β”‚ β”œβ”€β”€ Chapter 15: What Is Architecture?
β”‚ β”œβ”€β”€ Chapter 16: Independence
β”‚ β”œβ”€β”€ Chapter 17: Boundaries β€” Drawing Lines
β”‚ β”œβ”€β”€ Chapter 18: Boundary Anatomy
β”‚ β”œβ”€β”€ Chapter 19: Policy and Level
β”‚ β”œβ”€β”€ Chapter 20: Business Rules
β”‚ β”œβ”€β”€ Chapter 21: Screaming Architecture
β”‚ β”œβ”€β”€ Chapter 22: Testable Architecture
β”‚ β”œβ”€β”€ Chapter 23: Humble Objects
β”‚ β”œβ”€β”€ Chapter 24: Partial Boundaries
β”‚ β”œβ”€β”€ Chapter 25: Layers and Boundaries
β”‚ β”œβ”€β”€ Chapter 26: The Clean Architecture
β”‚ β”œβ”€β”€ Chapter 27: The Main Component
β”‚ β”œβ”€β”€ Chapter 28: Services: Great and Small
β”‚ └── Chapter 29: The Test Boundary
β”‚
β”œβ”€β”€ Part VI β€” Details
β”‚ β”œβ”€β”€ Chapter 30: The Database Is a Detail
β”‚ β”œβ”€β”€ Chapter 31: The Web Is a Detail
β”‚ └── Chapter 32: Frameworks Are Details
β”‚
β”œβ”€β”€ Chapter 33: Case Study β€” Video Sales
β”œβ”€β”€ Chapter 34: The Missing Chapter
└── Appendix A: Architecture Archaeology

The Central Thesis​

The book builds toward one defining insight:

Architecture is about deferring decisions. A good architect maximizes the number of decisions NOT made β€” keeping options open until the last responsible moment.

This single idea ripples across all levels:

  • At the code level β†’ SOLID principles keep classes flexible
  • At the component level β†’ Cohesion and coupling principles keep packages deployable independently
  • At the system level β†’ Boundaries keep business logic decoupled from infrastructure (databases, web frameworks, UI)

Key Mental Models​

1. The Dependency Rule​

The single most important rule in the book:

Source code dependencies must point only inward β€” toward higher-level policies.

Nothing in an inner circle (business rules) can know anything about something in an outer circle (frameworks, databases, UI).

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Frameworks & Drivers β”‚ ← outermost
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Interface Adapters β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ Use Cases β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ Entitiesβ”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Dependencies point INWARD β†’

2. Behavior vs. Structure​

Software has two values, and most teams optimize the wrong one:

ValueUrgencyImportance
Behavior (does it work?)UrgentSometimes important
Architecture (is it changeable?)Never urgentAlways important

Teams that only chase behavior end up with systems that work today but cost a fortune to change tomorrow.

3. The Three Programming Paradigms​

Each paradigm takes something away from the programmer:

ParadigmRemovesGives Architecture
StructuredUnrestrained gotoModules, functional decomposition
Object-OrientedUnrestrained function pointersPolymorphism, plugin architecture
FunctionalUnrestrained assignmentImmutability, safe concurrency

Why This Matters for Java / Spring Developers​

Spring applications are notorious for becoming "big balls of mud" where business logic is entangled with HTTP handlers, JPA entities, and Spring annotations. Clean Architecture gives you a concrete structure to fight this:

com.example.myapp
β”œβ”€β”€ domain/ ← Entities (pure Java, no Spring)
β”‚ β”œβ”€β”€ model/
β”‚ └── repository/ ← Interfaces only
β”œβ”€β”€ application/ ← Use Cases (orchestrates domain)
β”‚ └── usecase/
β”œβ”€β”€ adapter/ ← Controllers, Presenters, Gateways
β”‚ β”œβ”€β”€ web/ ← Spring MVC / REST controllers
β”‚ └── persistence/ ← Spring Data JPA implementations
└── infrastructure/ ← Spring config, DB config, main
└── config/

The key: your domain and application packages have zero Spring dependencies. They are testable with plain JUnit. Spring only appears at the boundary.


How to Use These Docs​

Each chapter has two sections:

  • πŸŽ“ For New Learners β€” Plain explanations with analogies and examples
  • πŸ”¬ Senior Deep Dive β€” Architectural implications, trade-offs, and advanced patterns

Read linearly for the full journey, or jump to the part most relevant to you right now.


Quick Reference: The SOLID Principles​

PrincipleOne-linerViolation Smell
SRPOne reason to changeClass changes for many different reasons
OCPOpen for extension, closed for modificationAdding features requires editing existing classes
LSPSubtypes must be substitutableOverride breaks caller assumptions
ISPNo client forced to depend on unused methodsFat interfaces
DIPDepend on abstractionsHigh-level module imports low-level module directly

Further Reading​


These docs were generated to accompany the reading of Clean Architecture (2017). Chapter summaries are intended as study guides, not replacements for the original text.