BLUEPRINT · The Solution Architect's Codex
Ch 06 · Architecture Styles & Patterns
Chapter 06 · The system-level vocabulary

Architecture Styles & Patterns — shapes that decide everything else

A style answers "what shape is the whole system?" A pattern answers "how do I solve this recurring problem inside it?" Choosing a style is the single most consequential architectural decision: it caps which qualities are cheap, which are expensive, and which are impossible without a re-write.

6.1 · Style vs pattern

The distinction was sharpened by Mary Shaw and David Garlan in Software Architecture: Perspectives on an Emerging Discipline (1996). A style describes the topology and interaction rules at the whole-system level — components, connectors, constraints. A pattern solves a recurring design problem in a context — usually below the system level. A system has one primary style (with possibly a secondary style nested inside) but contains dozens of patterns. "Microservices" is a style; "circuit breaker" is a pattern used inside it.

AspectStylePattern
ScopeWhole systemComponent / interaction
CardinalityUsually one primaryMany, layered
DrivesDeployment, topology, qualitiesClass-level structure, control flow
CatalogBass/Clements, Richards/Ford, ISO/IEC/IEEE 42010GoF, PoEAA, EIP, Cloud Design Patterns

6.2 · Catalog of architecture styles

StyleDefining traitSweet spot
Layered (n-tier)Strict horizontal layers, downward calls onlyCRUD line-of-business apps
Client-ServerThick server, thin client(s)Classic enterprise / SaaS
Pipes & FiltersUnidirectional dataflow through stateless filtersETL, signal processing, compilers
Hexagonal / Ports & Adapters (Cockburn 2005)Domain core, swap-able adapters at the edgesLong-lived domain logic; test isolation
Clean / Onion (Martin 2012 / Palermo 2008)Concentric layers; dependency rule points inwardSame as Hexagonal, explicit use-case layer
Modular MonolithOne deployable, strong internal module boundariesSmall teams, high cohesion, fast change
MicroservicesIndependently deployable services around business capabilitiesMany teams, divergent change cadences
SOAEnterprise-scope reusable services, often over ESBLarge enterprise IT, B2B integration
Event-Driven (EDA)Loose coupling via asynchronous events on a brokerStreaming, IoT, complex workflows
Space-BasedIn-memory data grid, processing close to dataExtreme variable load (ticketing, trading)
Serverless / FaaSStateless functions, managed runtime, per-invocation billingSpiky, event-triggered workloads
Microkernel (plug-in)Tiny core + extension plug-insIDEs, browsers, business-rule platforms
BrokerCentral broker dispatches between distributed nodesLegacy MOM, CORBA, RPC bridges
Peer-to-PeerNo central authority; nodes equalFile sharing, blockchains, mesh

6.3 · Deep dives

Layered

Presentation → Application → Domain → Infrastructure. Each layer depends only on the one below it (the "closed layers" rule). Cheap to staff, cheap to teach. Buys testability and maintainability; sacrifices performance (every call crosses layers) and deployability (one binary). NFR profile: + maintainability + portability – performance – scalability.

Hexagonal / Ports & Adapters

The domain is in the centre; it declares ports (interfaces). The outside world plugs in via adapters: REST adapter, Kafka adapter, Postgres adapter, test double adapter. The domain has zero knowledge of frameworks. Choose when the domain logic outlives the technology (insurance, finance, manufacturing). Avoid for thin CRUD apps where the ceremony exceeds the value. NFR profile: + testability + modifiability – time-to-market for simple cases.

Microservices

Term popularised by James Lewis & Martin Fowler (2014). Each service owns its data, is independently deployable, communicates over the network (usually HTTP/JSON, gRPC, or events). Buys independent scaling, polyglot persistence, and team autonomy. Costs: distributed-systems complexity (Fallacies of Distributed Computing — Deutsch 1994), eventual consistency, operational overhead, expensive end-to-end debugging. NFR profile: + scalability + deployability – simplicity – consistency (CAP).

Event-Driven (EDA)

Two flavours: broker topology (loose chain of consumers; e.g. NATS, RabbitMQ) and mediator topology (a central orchestrator coordinates; e.g. Camunda, Temporal). Producers do not know consumers. Buys decoupling, asynchrony, replayability (if log-based like Kafka). Costs: out-of-order delivery, idempotency burden, traceability. NFR profile: + scalability + extensibility – debuggability.

Serverless / FaaS

You write functions; the platform (AWS Lambda, Azure Functions, GCP Cloud Functions, Cloudflare Workers) provides the runtime, scaling, and billing per ms. Cold-start latency, 15-minute execution limits, vendor lock-in, and observability gaps are the recurring complaints. Sweet spot: event-triggered glue (S3-arrived → process), spiky APIs, scheduled jobs. NFR profile: + elasticity + cost-for-spiky – cold-start latency – portability.

6.4 · CQRS & Event Sourcing

CQRS (Command Query Responsibility Segregation — Greg Young, building on Bertrand Meyer's CQS) separates the write model from one or more read models. Event Sourcing stores the system of record as an append-only log of immutable domain events; current state is a fold over the log. The two pair naturally, but neither requires the other.

PromisePrice
Perfect audit trail (every change captured)Schema evolution of events is permanent
Many read models from one source of truthRead models eventually consistent
Time-travel + replay for new projectionsStorage grows monotonically
Natural fit with EDA + DDD aggregatesSignificant team learning curve

6.5 · Saga — distributed transactions without 2PC

A saga (Garcia-Molina & Salem, 1987) breaks a long-running business transaction into a sequence of local transactions, each with a compensating action that semantically undoes it on failure. Two coordination styles:

  • Orchestration — a central orchestrator (Temporal, Camunda, AWS Step Functions, Netflix Conductor) tells each service what to do, in order. Easier to reason about; risks coupling.
  • Choreography — services react to each other's events; no conductor. Highly decoupled; harder to trace globally.
Naming
"Long-Lived Transaction" is the original term. Pat Helland's Life beyond Distributed Transactions (2007) is the modern reference.

6.6 · Strangler Fig (Fowler 2004)

Replace a legacy system gradually by deflecting traffic to new components behind a façade. Over time the legacy is "strangled" route by route until it can be retired. The pattern's strength is risk reduction: every step is reversible and shippable. Requires a routing layer (API gateway, reverse proxy, anti-corruption layer) and disciplined feature parity testing.

6.7 · Hierarchical / cellular architecture

A cell is a self-contained vertical slice of the system (services + data + dependencies) sized so that failure of any single cell is recoverable and bounded. Amazon's "Cell-Based Architecture" papers, Slack's "cells", and Shopify's "pods" are real-world examples. The cell becomes the unit of blast-radius, capacity, and routing. Cells are typically homogenous; a "cell router" (shuffle-sharded for resilience) decides which cell handles which customer. See Ch 13 for resilience implications.

Cell-based topology (blast radius isolated)

Cell router (shuffle-sharded) Cell A services data Cell B services data Cell C services data Cell D (failed) isolated drained

6.8 · GoF patterns refresher

The 23 patterns from Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, Helm, Johnson, Vlissides — 1994) remain the lingua franca of OO design.

CreationalStructuralBehavioral
Abstract Factory · Builder · Factory Method · Prototype · SingletonAdapter · Bridge · Composite · Decorator · Facade · Flyweight · ProxyChain of Responsibility · Command · Interpreter · Iterator · Mediator · Memento · Observer · State · Strategy · Template Method · Visitor

For enterprise applications see Fowler's Patterns of Enterprise Application Architecture (2002). For cloud-native concerns see Microsoft's Cloud Design Patterns catalog (Ambassador, Anti-Corruption Layer, Bulkhead, Cache-Aside, CQRS, Circuit Breaker, Compensating Transaction, Competing Consumers, Federated Identity, Gatekeeper, Geode, Health Endpoint, Index Table, Leader Election, Materialized View, Pipes & Filters, Priority Queue, Publisher-Subscriber, Queue-Based Load Levelling, Retry, Saga, Scheduler-Agent-Supervisor, Sequential Convoy, Sharding, Sidecar, Static Content Hosting, Strangler Fig, Throttling, Valet Key). For messaging see Hohpe & Woolf's Enterprise Integration Patterns (Ch 08).

6.9 · Choosing a style

If your top-priority NFRs are…Consider…
Simplicity, time-to-market, single small teamModular Monolith (Layered or Hexagonal internals)
Independent scaling, many teams, divergent change cadencesMicroservices (with DDD bounded contexts)
Bursty / unpredictable load, event glueServerless / FaaS, EDA
Audit, replay, temporal queriesEvent Sourcing + CQRS
Extreme throughput, low latency at variable loadSpace-Based
Domain logic that outlives the tech stackHexagonal / Clean
Legacy replacementStrangler Fig over the legacy
Blast-radius isolation at scaleCellular over any underlying style
Anti-pattern
"Microservices because everyone else does." If you have one team of seven engineers, a modular monolith with strong boundaries will outperform a microservice fleet for years — and you can extract services later when boundaries prove stable.

6.10 · Self-check

Q1 · Which style places the domain at the centre and lets adapters at the edges be swapped without touching it?
Layered (n-tier)
Hexagonal / Ports & Adapters
Space-Based
Microkernel
Q2 · A saga's compensating action…
rolls back a database transaction via 2PC
semantically undoes a previously committed local step
retries the failed step indefinitely
routes the request to a backup region
Q3 · CQRS stands for…
Cloud Query Resource Sharing
Command Query Responsibility Segregation
Centralised Query Read Service
Compensating Query / Reply Sequence
Q4 · The Strangler Fig pattern is most associated with…
Eric Evans
Martin Fowler
Werner Vogels
Greg Young