Table of Contents
Preface xi
1 What Happens When There Are No "Best Practices"? 1
Why "The Hard Parts"? 2
Giving Timeless Advice About Software Architecture 3
The Importance of Data in Architecture 4
Architectural Decision Records 5
Architecture Fitness Functions 6
Using Fitness Functions 7
Architecture Versus Design: Keeping Definitions Simple 13
Introducing the Sysops Squad Saga 15
Nonticketing Workflow 16
Ticketing Workflow 17
A Bad Scenario 17
Sysops Squad Architectural Components 18
Sysops Squad Data Model 19
Part I Pulling Things Apart
2 Discerning Coupling in Software Architecture 25
Architecture (Quantum | Quanta) 28
Independently Deployable 29
High Functional Cohesion 30
High Static Coupling 30
Dynamic Quantum Coupling 38
Sysops Squad Saga: Understanding Quanta 42
3 Architectural Modularity 45
Modularity Drivers 49
Maintainability 50
Testability 54
Deployability 55
Scalability 56
Availability/Fault Tolerance 58
Sysops Squad Saga: Creating a Business Case 59
4 Architectural Decomposition 63
Is the Codebase Decomposable? 65
Afferent and Efferent Coupling 66
Abstractness and Instability 67
Distance from the Main Sequence 69
Component-Based Decomposition 71
Tactical Forking 73
Trade-Offs 77
Sysops Squad Saga: Choosing a Decomposition Approach 78
5 Component-Based Decomposition Patterns 81
Identify and Size Components Pattern 84
Pattern Description 84
Fitness Functions for Governance 87
Sysops Squad Saga: Sizing Components 90
Gather Common Domain Components Pattern 94
Pattern Description 94
Fitness Functions for Governance 95
Sysops Squad Saga: Gathering Common Components 97
Flatten Components Pattern 101
Pattern Description 102
Fitness Functions for Governance 107
Sysops Squad Saga: Flattening Components 107
Determine Component Dependencies Pattern 111
Pattern Description 112
Fitness Functions for Governance 117
Sysops Squad Saga: Identifying Component Dependencies 118
Create Component Domains Pattern 120
Pattern Description 121
Fitness Functions for Governance 122
Sysops Squad Saga: Creating Component Domains 123
Create Domain Services Pattern 126
Pattern Description 126
Fitness Functions for Governance 129
Sysops Squad Saga: Creating Domain Services 129
Summary 130
6 Pulling Apart Operational Data 131
Data Decomposition Drivers 132
Data Disintegrators 133
Data Integrators 146
Sysops Squad Saga: Justifying Database Decomposition 150
Decomposing Monolithic Data 151
Step 1: Analyze Database and Create Data Domains 156
Step 2: Assign Tables to Data Domains 156
Step 3: Separate Database Connections to Data Domains 158
Step 4: Move Schemas to Separate Database Servers 159
Step 5: Switch Over to Independent Database Servers 161
Selecting a Database Type 161
Relational Databases 163
Key-Value Databases 165
Document Databases 167
Column Family Databases 169
Graph Databases 171
NewSQL Databases 173
Cloud Native Databases 175
Time-Series Databases 177
Sysops Squad Saga: Polyglot Databases 179
7 Service Granularity 185
Granularity Disintegrators 188
Service Scope and Function 189
Code Volatility 191
Scalability and Throughput 192
Fault Tolerance 193
Security 195
Extensibility 196
Granularity Integrators 197
Database Transactions 198
Workflow and Choreography 200
Shared Code 203
Data Relationships 205
Finding the Right Balance 208
Sysops Squad Saga: Ticket Assignment Granularity 209
Sysops Squad Saga: Customer Registration Granularity 212
Part II Putting Things Back Together
8 Reuse Patterns 219
Code Replication 221
When to Use 223
Shared Library 223
Dependency Management and Change Control 224
Versioning Strategies 225
When To Use 227
Shared Service 228
Change Risk 229
Performance 231
Scalability 232
Fault Tolerance 232
When to Use 234
Sidecars and Service Mesh 234
When to Use 239
Sysops Squad Saga: Common Infrastructure Logic 239
Code Reuse: When Does It Add Value? 242
Reuse via Platforms 244
Sysops Squad Saga: Shared Domain Functionality 244
9 Data Ownership and Distributed Transactions 249
Assigning Data Ownership 250
Single Ownership Scenario 251
Common Ownership Scenario 252
Joint Ownership Scenario 253
Table Split Technique 254
Data Domain Technique 256
Delegate Technique 258
Service Consolidation Technique 261
Data Ownership Summary 262
Distributed Transactions 263
Eventual Consistency Patterns 267
Background Synchronization Pattern 269
Orchestrated Request-Based Pattern 272
Event-Based Pattern 277
Sysops Squad Saga: Data Ownership for Ticket Processing 279
10 Distributed Data Access 283
Interservice Communication Pattern 285
Column Schema Replication Pattern 287
Replicated Caching Pattern 288
Data Domain Pattern 293
Sysops Squad Saga: Data Access for Ticket Assignment 295
11 Managing Distributed Workflows 299
Orchestration Communication Style 301
Choreography Communication Style 306
Workflow State Management 311
Trade-Offs Between Orchestration and Choreography 315
State Owner and Coupling 315
Sysops Squad Saga: Managing Workflows 317
12 Transactional Sagas 323
Transactional Saga Patterns 324
Epic Saga(sao) Pattern 325
Phone Tag Saga(sac) Pattern 330
Fairy Tale Saga(seo) Pattern 333
Time Travel Saga(sec) Pattern 336
Fantasy Fiction Saga(aao) Pattern 340
Horror Story(aac) Pattern 343
Parallel Saga(aeo) Pattern 346
Anthology Saga(aec) Pattern 349
State Management and Eventual Consistency 351
Saga State Machines 352
Techniques for Managing Sagas 356
Sysops Squad Saga: Atomic Transactions and Compensating Updates 358
13 Contracts 365
Strict Versus Loose Contracts 367
Trade-Offs Between Strict and Loose Contracts 370
Contracts in Microservices 372
Stamp Coupling 376
Over-Coupling via Stamp Coupling 376
Bandwidth 377
Stamp Coupling for Workflow Management 378
Sysops Squad Saga: Managing Ticketing Contracts 379
14 Managing Analytical Data 381
Previous Approaches 382
The Data Warehouse 382
The Data Lake 386
The Data Mesh 389
Definition of Data Mesh 389
Data Product Quantum 390
Data Mesh, Coupling, and Architecture Quantum 393
When to Use Data Mesh 393
Sysops Squad Saga: Data Mesh 394
15 Build Your Own Trade-Off Analysis 399
Finding Entangled Dimensions 401
Coupling 401
Analyze Coupling Points 402
Assess Trade-Offs 403
Trade-Off Techniques 404
Qualitative Versus Quantative Analysis 404
MECE Lists 404
The "Out-of-Context" Trap 405
Model Relevant Domain Cases 408
Prefer Bottom Line over Overwhelming Evidence 410
Avoiding Snake Oil and Evangelism 412
Sysops Squad Saga: Epilogue 416
A Concept and Term References 417
B Architecture Decision Record References 419
C Trade-Off References 421
Index 425