O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

Book Description

Practical Software Architecture Solutions from the Legendary Robert C. Martin (“Uncle Bob”)

By applying universal rules of software architecture, you can dramatically improve developer productivity throughout the life of any software system. Now, building upon the success of his best-selling books Clean Code and The Clean Coder, legendary software craftsman Robert C. Martin (“Uncle Bob”) reveals those rules and helps you apply them.

Martin’s Clean Architecture doesn’t merely present options. Drawing on over a half-century of experience in software environments of every imaginable type, Martin tells you what choices to make and why they are critical to your success. As you’ve come to expect from Uncle Bob, this book is packed with direct, no-nonsense solutions for the real challenges you’ll face—the ones that will make or break your projects.

  • Learn what software architects need to achieve—and core disciplines and practices for achieving it
  • Master essential software design principles for addressing function, component separation, and data management
  • See how programming paradigms impose discipline by restricting what developers can do
  • Understand what’s critically important and what’s merely a “detail”
  • Implement optimal, high-level structures for web, database, thick-client, console, and embedded applications
  • Define appropriate boundaries and layers, and organize components and services
  • See why designs and architectures go wrong, and how to prevent (or fix) these failures

Clean Architecture is essential reading for every current or aspiring software architect, systems analyst, system designer, and software manager—and for every programmer who must execute someone else’s designs.

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Dedication
  5. Contents
  6. Foreword
  7. Preface
  8. Acknowledgments
  9. About the Author
  10. PART I Introduction
    1. Chapter 1 What Is Design and Architecture?
      1. The Goal?
      2. Case Study
      3. Conclusion
    2. Chapter 2 A Tale of Two Values
      1. Behavior
      2. Architecture
      3. The Greater Value
      4. Eisenhower’s Matrix
      5. Fight for the Architecture
  11. PART II Starting with the Bricks: Programming Paradigms
    1. Chapter 3 Paradigm Overview
      1. Structured Programming
      2. Object-Oriented Programming
      3. Functional Programming
      4. Food for Thought
      5. Conclusion
    2. Chapter 4 Structured Programming
      1. Proof
      2. A Harmful Proclamation
      3. Functional Decomposition
      4. No Formal Proofs
      5. Science to the Rescue
      6. Tests
      7. Conclusion
    3. Chapter 5 Object-Oriented Programming
      1. Encapsulation?
      2. Inheritance?
      3. Polymorphism?
      4. Conclusion
    4. Chapter 6 Functional Programming
      1. Squares of Integers
      2. Immutability and Architecture
      3. Segregation of Mutability
      4. Event Sourcing
      5. Conclusion
  12. PART III Design Principles
    1. Chapter 7 SRP: The Single Responsibility Principle
      1. Symptom 1: Accidental Duplication
      2. Symptom 2: Merges
      3. Solutions
      4. Conclusion
    2. Chapter 8 OCP: The Open-Closed Principle
      1. A Thought Experiment
      2. Directional Control
      3. Information Hiding
      4. Conclusion
    3. Chapter 9 LSP: The Liskov Substitution Principle
      1. Guiding the Use of Inheritance
      2. The Square/Rectangle Problem
      3. LSP and Architecture
      4. Example LSP Violation
      5. Conclusion
    4. Chapter 10 ISP: The Interface Segregation Principle
      1. ISP and Language
      2. ISP and Architecture
      3. Conclusion
    5. Chapter 11 DIP: The Dependency Inversion Principle
      1. Stable Abstractions
      2. Factories
      3. Concrete Components
      4. Conclusion
  13. PART IV Component Principles
    1. Chapter 12 Components
      1. A Brief History of Components
      2. Relocatability
      3. Linkers
      4. Conclusion
    2. Chapter 13 Component Cohesion
      1. The Reuse/Release Equivalence Principle
      2. The Common Closure Principle
      3. The Common Reuse Principle
      4. The Tension Diagram for Component Cohesion
      5. Conclusion
    3. Chapter 14 Component Coupling
      1. The Acyclic Dependencies Principle
      2. Top-Down Design
      3. The Stable Dependencies Principle
      4. The Stable Abstractions Principle
      5. Conclusion
  14. PART V Architecture
    1. Chapter 15 What Is Architecture?
      1. Development
      2. Deployment
      3. Operation
      4. Maintenance
      5. Keeping Options Open
      6. Device Independence
      7. Junk Mail
      8. Physical Addressing
      9. Conclusion
    2. Chapter 16 Independence
      1. Use Cases
      2. Operation
      3. Development
      4. Deployment
      5. Leaving Options Open
      6. Decoupling Layers
      7. Decoupling Use Cases
      8. Decoupling Mode
      9. Independent Develop-ability
      10. Independent Deployability
      11. Duplication
      12. Decoupling Modes (Again)
      13. Conclusion
    3. Chapter 17 Boundaries: Drawing Lines
      1. A Couple of Sad Stories
      2. FitNesse
      3. Which Lines Do You Draw, and When Do You Draw Them?
      4. What About Input and Output?
      5. Plugin Architecture
      6. The Plugin Argument
      7. Conclusion
    4. Chapter 18 Boundary Anatomy
      1. Boundary Crossing
      2. The Dreaded Monolith
      3. Deployment Components
      4. Threads
      5. Local Processes
      6. Services
      7. Conclusion
    5. Chapter 19 Policy and Level
      1. Level
      2. Conclusion
    6. Chapter 20 Business Rules
      1. Entities
      2. Use Cases
      3. Request and Response Models
      4. Conclusion
    7. Chapter 21 Screaming Architecture
      1. The Theme of an Architecture
      2. The Purpose of an Architecture
      3. But What About the Web?
      4. Frameworks Are Tools, Not Ways of Life
      5. Testable Architectures
      6. Conclusion
    8. Chapter 22 The Clean Architecture
      1. The Dependency Rule
      2. A Typical Scenario
      3. Conclusion
    9. Chapter 23 Presenters and Humble Objects
      1. The Humble Object Pattern
      2. Presenters and Views
      3. Testing and Architecture
      4. Database Gateways
      5. Data Mappers
      6. Service Listeners
      7. Conclusion
    10. Chapter 24 Partial Boundaries
      1. Skip the Last Step
      2. One-Dimensional Boundaries
      3. Facades
      4. Conclusion
    11. Chapter 25 Layers and Boundaries
      1. Hunt the Wumpus
      2. Clean Architecture?
      3. Crossing the Streams
      4. Splitting the Streams
      5. Conclusion
    12. Chapter 26 The Main Component
      1. The Ultimate Detail
      2. Conclusion
    13. Chapter 27 Services: Great and Small
      1. Service Architecture?
      2. Service Benefits?
      3. The Kitty Problem
      4. Objects to the Rescue
      5. Component-Based Services
      6. Cross-Cutting Concerns
      7. Conclusion
    14. Chapter 28 The Test Boundary
      1. Tests as System Components
      2. Design for Testability
      3. The Testing API
      4. Conclusion
    15. Chapter 29 Clean Embedded Architecture
      1. App-titude Test
      2. The Target-Hardware Bottleneck
      3. Conclusion
  15. PART VI Details
    1. Chapter 30 The Database Is a Detail
      1. Relational Databases
      2. Why Are Database Systems So Prevalent?
      3. What If There Were No Disk?
      4. Details
      5. But What about Performance?
      6. Anecdote
      7. Conclusion
    2. Chapter 31 The Web Is a Detail
      1. The Endless Pendulum
      2. The Upshot
      3. Conclusion
    3. Chapter 32 Frameworks Are Details
      1. Framework Authors
      2. Asymmetric Marriage
      3. The Risks
      4. The Solution
      5. I Now Pronounce You …
      6. Conclusion
    4. Chapter 33 Case Study: Video Sales
      1. The Product
      2. Use Case Analysis
      3. Component Architecture
      4. Dependency Management
      5. Conclusion
    5. Chapter 34 The Missing Chapter
      1. Package by Layer
      2. Package by Feature
      3. Ports and Adapters
      4. Package by Component
      5. The Devil Is in the Implementation Details
      6. Organization versus Encapsulation
      7. Other Decoupling Modes
      8. Conclusion: The Missing Advice
  16. Afterword
  17. PART VII Appendix
    1. Appendix A Architecture Archaeology
  18. Index