Clean Architecture: A Craftsman's Guide to Software Structu…


Title Page
4

Copyright Page
5

Dedication
6

Contents
7

Foreword
15

Preface
19

Acknowledgments
22

About the Author
24

PART I Introduction
25

Chapter 1 What Is Design and Architecture?
27

The Goal?
28

Case Study
28

Conclusion
34

Chapter 2 A Tale of Two Values
36

Behavior
36

Architecture
37

The Greater Value
38

Eisenhower’s Matrix
38

Fight for the Architecture
40

PART II Starting with the Bricks: Programming Paradigms
41

Chapter 3 Paradigm Overview
43

Structured Programming
43

Object-Oriented Programming
44

Functional Programming
44

Food for Thought
44

Conclusion
45

Chapter 4 Structured Programming
46

Proof
47

A Harmful Proclamation
48

Functional Decomposition
49

No Formal Proofs
49

Science to the Rescue
50

Tests
51

Conclusion
51

Chapter 5 Object-Oriented Programming
52

Encapsulation?
53

Inheritance?
55

Polymorphism?
58

Conclusion
63

Chapter 6 Functional Programming
65

Squares of Integers
65

Immutability and Architecture
67

Segregation of Mutability
68

Event Sourcing
69

Conclusion
70

PART III Design Principles
72

Chapter 7 SRP: The Single Responsibility Principle
75

Symptom 1: Accidental Duplication
76

Symptom 2: Merges
78

Solutions
79

Conclusion
81

Chapter 8 OCP: The Open-Closed Principle
82

A Thought Experiment
83

Directional Control
87

Information Hiding
87

Conclusion
87

Chapter 9 LSP: The Liskov Substitution Principle
89

Guiding the Use of Inheritance
89

The Square/Rectangle Problem
90

LSP and Architecture
91

Example LSP Violation
92

Conclusion
94

Chapter 10 ISP: The Interface Segregation Principle
95

ISP and Language
97

ISP and Architecture
97

Conclusion
98

Chapter 11 DIP: The Dependency Inversion Principle
99

Stable Abstractions
100

Factories
101

Concrete Components
102

Conclusion
103

PART IV Component Principles
104

Chapter 12 Components
105

A Brief History of Components
106

Relocatability
108

Linkers
109

Conclusion
110

Chapter 13 Component Cohesion
112

The Reuse/Release Equivalence Principle
113

The Common Closure Principle
114

The Common Reuse Principle
115

The Tension Diagram for Component Cohesion
116

Conclusion
117

Chapter 14 Component Coupling
119

The Acyclic Dependencies Principle
119

Top-Down Design
125

The Stable Dependencies Principle
126

The Stable Abstractions Principle
132

Conclusion
138

PART V Architecture
140

Chapter 15 What Is Architecture?
141

Development
142

Deployment
143

Operation
144

Maintenance
144

Keeping Options Open
145

Device Independence
147

Junk Mail
148

Physical Addressing
149

Conclusion
150

Chapter 16 Independence
151

Use Cases
151

Operation
152

Development
153

Deployment
153

Leaving Options Open
153

Decoupling Layers
154

Decoupling Use Cases
155

Decoupling Mode
155

Independent Develop-ability
156

Independent Deployability
157

Duplication
157

Decoupling Modes (Again)
158

Conclusion
160

Chapter 17 Boundaries: Drawing Lines
161

A Couple of Sad Stories
162

FitNesse
164

Which Lines Do You Draw, and When Do You Draw Them?
166

What About Input and Output?
169

Plugin Architecture
170

The Plugin Argument
171

Conclusion
173

Chapter 18 Boundary Anatomy
174

Boundary Crossing
174

The Dreaded Monolith
175

Deployment Components
177

Threads
177

Local Processes
178

Services
178

Conclusion
179

Chapter 19 Policy and Level
180

Level
181

Conclusion
184

Chapter 20 Business Rules
185

Entities
186

Use Cases
187

Request and Response Models
189

Conclusion
189

Chapter 21 Screaming Architecture
191

The Theme of an Architecture
192

The Purpose of an Architecture
192

But What About the Web?
193

Frameworks Are Tools, Not Ways of Life
193

Testable Architectures
193

Conclusion
194

Chapter 22 The Clean Architecture
195

The Dependency Rule
196

A Typical Scenario
200

Conclusion
201

Chapter 23 Presenters and Humble Objects
202

The Humble Object Pattern
202

Presenters and Views
203

Testing and Architecture
204

Database Gateways
204

Data Mappers
204

Service Listeners
205

Conclusion
205

Chapter 24 Partial Boundaries
206

Skip the Last Step
207

One-Dimensional Boundaries
207

Facades
208

Conclusion
209

Chapter 25 Layers and Boundaries
210

Hunt the Wumpus
210

Clean Architecture?
212

Crossing the Streams
214

Splitting the Streams
215

Conclusion
217

Chapter 26 The Main Component
219

The Ultimate Detail
219

Conclusion
223

Chapter 27 Services: Great and Small
224

Service Architecture?
224

Service Benefits?
225

The Kitty Problem
226

Objects to the Rescue
228

Component-Based Services
229

Cross-Cutting Concerns
231

Conclusion
231

Chapter 28 The Test Boundary
233

Tests as System Components
233

Design for Testability
234

The Testing API
235

Conclusion
236

Chapter 29 Clean Embedded Architecture
237

App-titude Test
239

The Target-Hardware Bottleneck
242

Conclusion
252

PART VI Details
254

Chapter 30 The Database Is a Detail
255

Relational Databases
256

Why Are Database Systems So Prevalent?
256

What If There Were No Disk?
257

Details
258

But What about Performance?
258

Anecdote
258

Conclusion
260

Chapter 31 The Web Is a Detail
261

The Endless Pendulum
262

The Upshot
263

Conclusion
264

Chapter 32 Frameworks Are Details
265

Framework Authors
265

Asymmetric Marriage
266

The Risks
266

The Solution
267

I Now Pronounce You …
268

Conclusion
268

Chapter 33 Case Study: Video Sales
269

The Product
269

Use Case Analysis
270

Component Architecture
272

Dependency Management
274

Conclusion
274

Chapter 34 The Missing Chapter
275

Package by Layer
276

Package by Feature
278

Ports and Adapters
279

Package by Component
281

The Devil Is in the Implementation Details
286

Organization versus Encapsulation
286

Other Decoupling Modes
290

Conclusion: The Missing Advice
291

PART VII Appendix
293

Appendix A Architecture Archaeology
294

Index
335

Made with FlippingBook - Online catalogs