Architecture decision records
Architecture decision records
An architecture decision record (ADR) captures a consequential decision, its context, considered alternatives and expected consequences. It keeps the reasoning available when the original conditions change.
A useful ADR is short, dated and owned. Include status (proposed, accepted, superseded or rejected), requirements and constraints, options, decision, rationale, trade-offs, validation plan and review trigger. An accepted decision records agreement; it does not prove its assumptions. Supersede rather than silently rewriting history. For a fictional order system, an external label service is occasionally slow. Options are synchronous in-request calls, an in-process queue, or a durable worker with an outbox. If order acceptance must survive crashes, an in-memory queue is not sufficient. If the client must receive a label immediately, a queued response changes the contract and needs product agreement. Measure end-to-end delay, error rates, queue age and recovery against an agreed service objective; use synthetic estimates only as hypotheses. Do not optimize for an arbitrary pattern or pretend that estimated latency is measured. A small spike (limited experiment) can expose a risk without committing to a full rewrite.
Baseline: .NET 10 / C# 14. All C# results below are reasoned, not executed. Offline models and multi-project labs are explicitly distinguished.
Make an assumption explicit with a decision table
Compare modeled costs, not observed measurements. Both options have the same local order-write estimate.
Use the archived Fixture.csproj with an approved .NET 10 SDK. No third-party packages are required. Inspect the project, then build and run with the approved SDK.
using System;int writeMs = 40, labelMs = 350, enqueueMs = 10;Console.WriteLine($"sync response estimate: {writeMs + labelMs} ms");Console.WriteLine($"queued acceptance estimate: {writeMs + enqueueMs} ms");Console.WriteLine("queued response has no label yet");Expected result (not executed):
sync response estimate: 390 msqueued acceptance estimate: 50 msqueued response has no label yetThe estimates are assumptions and omit concurrency, transport and recovery overhead. Do not compare response latency without considering different response semantics.
Characterize the contract before changing it
Compare two possible acceptance policies using an unavailable label service. This is a pure state model, not actual durable storage.
Use the archived Fixture.csproj with an approved .NET 10 SDK. No third-party packages are required. Inspect the project, then build and run with the approved SDK.
using System;foreach (bool available in new[] { true, false }) { Console.WriteLine($"sync: {AcceptSync(available)}; queued: {AcceptQueued(available)}");}static string AcceptSync(bool available) => available ? "label ready" : "request failed";static string AcceptQueued(bool available) { _ = available; return "accepted; pending"; }Expected result (not executed):
sync: label ready; queued: accepted; pendingsync: request failed; queued: accepted; pendingQueued acceptance is valid only after durable order and publication intent are committed. The example models the response contract, not that commit. If immediate labels are required, this change is incompatible.
Encode a review trigger as a policy
Check a fictional workload threshold with recorded observations. A trigger requests review, not automatic architectural migration.
Use the archived Fixture.csproj with an approved .NET 10 SDK. No third-party packages are required. Inspect the project, then build and run with the approved SDK.
using System;foreach (int p95 in new[] { 220, 400, 401 }) Console.WriteLine($"{p95}: {ReviewNeeded(p95, 400)}");static bool ReviewNeeded(int observedP95Ms, int budgetMs) => observedP95Ms > budgetMs;Expected result (not executed):
220: False400: False401: Truep95 means the 95th percentile of the measured distribution. Here values are synthetic; use sufficient samples, a defined window and uncertainty in a real ADR. Review cost, failures and semantics as well as latency.
Apply the concept
Write ADR-001 for the fictional label service. Include both response contracts, crash recovery, rejected alternatives, and a review trigger.
Use the manual practice and knowledge check. Do not deploy or publish these fixtures.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Architecture decision records — knowledge check
Apply the lesson concepts to the following scenarios.
What makes an ADR useful after a team changes?
What does a proposed latency estimate establish?
Why can queued acceptance be incompatible with an existing API?
Which alternative fails a crash-survival requirement by itself?
How should an accepted ADR be replaced?