Home

/

The Production-Ready Playbook

/

Altitude 2: Component

Altitude 2: Component

Appendix C
Appendix
4
min read

Altitude 2 — Component

Primary sources: Fowler (PoEAA + bliki) and Robert C. Martin (SOLID), both listed in full above.

  • Dependency Injection / Inversion of Control — Fowler, "…the Dependency Injection pattern" (2004). https://martinfowler.com/articles/injection.html The "D" in SOLID (Robert C. Martin). The order service receives an IPaymentGateway, never constructs one. In C#: Microsoft.Extensions.DependencyInjection.
  • Data Gateway (Table Data Gateway / Row Data Gateway) — Fowler, PoEAA. https://martinfowler.com/eaaCatalog/tableDataGateway.html OrderGateway and MenuGateway over stored procedures: the anchor for the book's SQL-first, anti-ORM stance. Contrast Data Mapper (https://martinfowler.com/eaaCatalog/dataMapper.html), which is what an ORM like EF implements.
  • Ports & Adapters (Hexagonal Architecture) — Alistair Cockburn, 2005. https://alistair.cockburn.us/hexagonal-architecture/ Cousins: Robert C. Martin's Clean Architecture and Onion; we teach the minimal form, order domain at the centre.
  • Pipeline / Middleware — Chain of Responsibility (GoF) at the object level; concretely, ASP.NET Core middleware that resolves tenant_id on every request. https://learn.microsoft.com/aspnet/core/fundamentals/middleware/
  • Mediator — GoF Mediator at the object level; at the application level, the MediatR library by Jimmy Bogard. https://github.com/jbogard/MediatR A PlaceOrder request routed to its handler. The two are distinct; cite accordingly.
  • Anti-Corruption Layer — Evans, Domain-Driven Design (2003). Summary: https://learn.microsoft.com/azure/architecture/patterns/anti-corruption-layer The higher-altitude cousin of Adapter; here it insulates the order model from a legacy restaurant POS.
  • Domain Events — Evans (DDD); Fowler bliki. https://martinfowler.com/eaaDev/DomainEvent.html OrderPlaced fans out to kitchen, stock, and confirmation; in C#, often dispatched via MediatR INotification.
  • Specification — Evans, Domain-Driven Design (2003); Evans & Fowler, "Specifications" (2002). https://www.martinfowler.com/apsupp/spec.pdf A composable business rule (IsSatisfiedBy) whose And/Or/Not combinators are a Composite; here "restaurant open and within range," reused across the search query, the order validation, and the UI.
  • Honorable mentions — Result / ErrorOr functional error handling; plain Layered architecture.
Order placement through one component slice

Altitude 3 — Data & Persistence

Primary sources: Fowler (PoEAA + bliki) for the read/write-split combo and concurrency; the cloud catalogue for the rest.

  • Multitenancy — recommended default: shared schema + tenant discriminator (tenant_id, where the restaurant/brand is the tenant) + Row-Level Security.

- Microsoft, Multitenant SaaS database tenancy patterns. https://learn.microsoft.com/azure/azure-sql/database/saas-tenancy-app-design-patterns The database-per-tenant / schema-per-tenant / shared-schema spectrum. - PostgreSQL, Row Security Policies (RLS). https://www.postgresql.org/docs/current/ddl-rowsecurity.html The mechanism that turns shared-schema isolation by tenant_id into a database guarantee.

  • Event Sourcing — Fowler bliki. https://martinfowler.com/eaaDev/EventSourcing.html Popularised by Greg Young. The order is an append-only event stream.
  • CQRS — Greg Young and Udi Dahan; Fowler bliki. https://martinfowler.com/bliki/CQRS.html The umbrella separating the order write model from its read views. The book's heaviest skip-if; pair the power with the cost caveat.
  • Materialized View — Azure Cloud Design Patterns. https://learn.microsoft.com/azure/architecture/patterns/materialized-view The read models in the golden combo: courier task-list, customer order-history, restaurant live-board.
  • Optimistic Concurrency (Optimistic Offline Lock) — Fowler, PoEAA. https://martinfowler.com/eaaCatalog/optimisticOfflineLock.html Rowversion / xmin / ETag; stops two menu edits from clobbering each other.
  • Evolutionary Database Design / migrations — Fowler & Sadalage, "Evolutionary Database Design." https://martinfowler.com/articles/evodb.html Versioned, forward-only migrations for the orders schema (DbUp / Flyway-style; not EF migrations).
  • Sharding / Partitioning — Azure Cloud Design Patterns. https://learn.microsoft.com/azure/architecture/patterns/sharding Orders sharded by city.
  • Cache-Aside — Azure Cloud Design Patterns. https://learn.microsoft.com/azure/architecture/patterns/cache-aside Load-on-miss for the menu; pair with an invalidation strategy.
  • Soft Delete / Temporal — Fowler, temporal patterns (https://martinfowler.com/eaaDev/timeNarrative.html); SQL:2011 system-versioned temporal tables (https://learn.microsoft.com/sql/relational-databases/tables/temporal-tables). Menu-price history you can recover and audit.
  • Honorable mentions — lightweight Unit of Work (Fowler, PoEAA, https://martinfowler.com/eaaCatalog/unitOfWork.html — used here only as a transaction boundary, not an ORM); Read Replicas; Connection Pooling.
One log, many read models
the-pareto-stack-cloud-design-patterns-for-small-teams
the-ladder-of-altitudes
how-to-read-this
object-level-the-patterns-that-earn-their-keep
decorator
state
component-level-structuring-one-service
ports-and-adapters-hexagonal
mediator-the-commandquery-split
data-persistence
optimistic-concurrency
messaging-scale
outbox
resilience-staying-up-when-dependencies-dont
rate-limiting-throttling
timeout-fallback
the-composed-pipeline
observability-diagnostics-seeing-inside-production
metrics-the-four-golden-signals
externalised-configuration
hosting-cloud-agnostic-by-default
sidecar-ambassador
orchestrator-agnostic-deploy
a-reference-service
the-relay-outbox-to-queue
the-payment-saga-charge-pay-out-compensate
the-over-engineering-tax
conclusion-production-ready-deliberately
the-pattern-quick-reference-card
altitude-3-data-persistence
altitude-5-resilience
the-skip-list
full-event-sourcing-for-crud
robert-c-martin-uncle-bob-the-house-authority-for-structure
altitude-2-component
altitude-4-messaging-scale
altitude-6-observability-diagnostics

Download the full PDF for free?

Free download — no account required

Get the PDF
Get the PDF
Related Chapters
Free Download
Get the full PDF
All pages, including all code examples, diagrams, and the appendix reference card.
No spam. Unsubscribe at any time.
Your email won't be shared.
Oops! There's a problem with your request. We're working on fixing it. Please try again later.