Volume 6 · Chapter 11 — Enterprise Application Architecture and Design Patterns
Volume 6 Summary and Interview Rapid-Fire
What This Volume Covered
- Clean Architecture and the Dependency Rule
- Advanced Domain-Driven Design
- CQRS and Event Sourcing
- Enterprise design patterns
- SOLID principles in large systems
- Dependency injection architecture
- Modular monoliths
- Microservice design patterns
- Integration architecture
- Principal-level system design
How the Pieces Fit Together
These topics are one continuous story. Clean Architecture and SOLID keep a single service changeable; DDD tells you where to draw boundaries; CQRS and design patterns shape the model inside a boundary; DI wires it together; the modular monolith realises the boundaries in one deployable; microservice and integration patterns take those boundaries across the network when scale demands; and system-design judgment decides how far along that path a given problem should travel. The recurring theme ismanage coupling deliberatelyandadd complexity only when a concrete force requires it.
In one sentence, what is the Dependency Rule?
Source-code dependencies may only point inward toward higher-level policy, so the domain depends on nothing and infrastructure depends on the domain’s abstractions.
Aggregate in one sentence?
A consistency boundary around related objects, guarded by a single root that is the only entry point for changes, modified one-per-transaction.
Does CQRS require two databases?
No - it separates the command and query models; separate storage and eventual consistency are an optional optimisation you add when read scaling demands it.
Outbox pattern in one sentence?
Write the outgoing message into an outbox table in the same transaction as the state change, then relay it to the broker, so state and event are atomic and delivery is reliable at-least-once.
Modular monolith vs microservices in one line?
Same strong boundaries; the modular monolith keeps them in-process for simplicity, microservices push them across the network for independent scaling and autonomy at the cost of distributed complexity.
Why must distributed consumers be idempotent?
Because at-least-once delivery and retries mean the same message can arrive more than once, and only idempotent processing keeps the effect correct.
Choreography vs orchestration for sagas?
Choreography = services react to each other’s events (simple flows); orchestration = a central coordinator drives the steps (complex, long-running flows that need explicit visibility).
When do you pick consistency over availability?
When a stale or lost write causes real business harm - money, inventory, compliance - as with a ledger; otherwise favour availability and low latency.