Architecture Documentation and Communication Questions
Making an architecture legible to others: architecture decision records (templates, alternatives and consequences, lifecycle, supersession, tagging and discoverability), diagramming and visualization (C4, sequence, deployment, data-flow and trust-boundary diagrams, notation conventions), and communicating designs to technical and non-technical stakeholders. Covers capturing rationale, documenting what a system does under failure, load and consistency trade-offs, recording observability, SLO and security content, running design reviews, keeping docs and diagrams current, and presenting a system clearly under time pressure. The communication skill that separates a good design from an understood one.
You are reviewing an architecture diagram of a payments platform that mixes synchronous authorisation with asynchronous settlement, and the diagram has no reliability annotations. What do you ask the author to add, and which gaps worry you most?
Sample Answer
Direct answer
I would ask the author for four things before I approve: (1) per-arrow reliability annotations (timeout, retry policy, idempotency, and what the caller does on failure); (2) an explicit state machine for a payment (a diagram of every state it can be in and which events move it between them), including an "unknown outcome" state; (3) the reconciliation path that proves money and records agree; (4) trust boundaries and ownership. The gap that worries me most is a synchronous authorisation call that times out with no defined way to find out what actually happened, because that is how you get double charges or lost payments.
What to ask the author to add, grouped by the two halves
Synchronous authorisation (customer waiting)
- Latency budget: if checkout must answer within 5 s, each hop gets a share and timeouts must nest, each outer timeout longer than the inner one plus its retries. For example client 5 s, gateway 4 s, acquirer call 3 s with no retry, so the acquirer times out first and the gateway can still report the outcome. If the acquirer call is retried once, the inner total is 3 + 3 = 6 s, which already exceeds the gateway's 4 s, so the budget must change: for example 1.5 s per attempt with one retry (3 s worst case, ignoring the backoff wait), or no retry at this hop and rely on the status inquiry instead.
- Idempotency (repeat-safe requests): an idempotency key from the client, stored with the result, so a retried request returns the original outcome instead of charging again.
- Behaviour when the acquirer (the bank-side card processor) is slow or down: decline, retry a second processor, or queue? Pick one and draw it.
Asynchronous settlement (money movement later)
- Delivery guarantee on the queue (at-least-once) and consumers that dedupe on payment ID.
- Dead-letter queue (DLQ, where repeatedly failing messages are parked), with an owner and an alert on its depth.
- Reconciliation: a scheduled comparison of our ledger (our record of every payment and amount) against the processor's settlement file (the daily report of what money it actually moved), with an alert on any mismatch. Without it, drift is silent.
- The outbox pattern (write the event and the state change in one database transaction, publish afterwards) so events are never lost between the database and the queue.
Across both
- SLOs (service-level objectives) per path: authorisation availability and latency; settlement completeness within a stated window.
- Trust boundaries and PCI DSS scope (the card-industry security standard): where card data lives, and that only tokens travel elsewhere.
- Ownership per component, runbook links, and RTO/RPO (recovery time objective, how fast we recover, and recovery point objective, how much data we may lose).
The payment state machine I would insist on
stateDiagram-v2
[*] --> Received
Received --> Authorized: acquirer approves
Received --> Declined: acquirer declines
Received --> Unknown: timeout
Unknown --> Authorized: status inquiry says approved
Unknown --> Declined: status inquiry says none
Authorized --> Settled: settlement file matches
Authorized --> Mismatch: settlement file differs
Mismatch --> Settled: manual correction
Worked example: the timeout
The acquirer call has a 3 second timeout and it fires. Without the Unknown state, the service either retries (risking a second authorisation) or fails the payment (risking a hold on the customer's card with no order). With it, the service records Unknown, asks the acquirer "what happened to reference k1?" (a status inquiry), and moves the payment to Authorized or Declined. If the inquiry also fails, a background job keeps asking, and reconciliation is the safety net.
Which gaps worry me most (in order)
- Ambiguous timeout outcome (above).
- No idempotency on settlement events, so duplicates double-post the ledger.
- No reconciliation, so errors are found by customers.
- Unmarked card-data boundary.
My rule for what blocks approval: a gap blocks if, when it happens, money is wrongly moved or nobody can tell. The first three each meet that test (double charge, double posting, silent drift); the card-data boundary is a compliance blocker. Everything else can be fixed after launch.
Extra check, service mesh (less commonly asked). If the diagram includes a service mesh (sidecar proxies handling service-to-service traffic), it must also show: whether retries are configured in the mesh AND in application code (retries multiply), timeouts per route, circuit-breaking settings, whether traffic is encrypted between services (mutual TLS: both sides prove their identity with certificates), and which calls bypass the mesh.
Extra check, shared cache (less commonly asked). If a shared Redis cache sits in a model-serving path, ask: what happens on a cache miss or Redis outage (fallback and load on the backing store)? Time-to-live (TTL, how long an entry lives) versus staleness of features; a stampede (many simultaneous misses all hitting the backing store together); eviction policy (which entries are dropped when memory is full); who owns the keyspace; and whether a single shared instance is a single point of failure (one component whose loss takes everything down). Example: a 60 s TTL on a feature means predictions may use values up to 60 s old, which the model owner must accept in writing.
Trade-offs and pitfalls
- Asking for everything makes the review unusable; mark which asks block approval (timeout outcome, idempotency, reconciliation) and which are follow-ups.
- Adding a second acquirer improves availability but adds routing complexity and reconciliation for two files.
You are documenting a message-bus-based ingestion pipeline. What must the documentation tell producers, consumers and operators, and how would you diagram it so delivery guarantees and failure behaviour are unambiguous?
Sample Answer
Direct answer
A message-bus pipeline document is a contract with three audiences. Producers need to know what to send and what is promised on publish. Consumers need the delivery, ordering and duplicate rules, and what happens to a message that fails. Operators need retention, partition, capacity, alerts and replay steps. The diagram must show partitions, retries and the dead-letter path explicitly, because those are where delivery guarantees are decided.
Vocabulary first
- Broker: the server that receives messages and holds them until consumers read them.
- Topic: a named log of messages on the broker, like one labelled mailbox stream (here
model-updates). - Partition: one slice of a topic's log; messages with the same key always land in the same partition, which is why order is kept per key. The key is hashed to a number and mapped to a partition (for example hash 17 on 6 partitions is 17 mod 6 = partition 5).
- Consumer group: a set of consumers that share a topic, each partition going to exactly one member. With 6 partitions, at most 6 consumers in a group do useful work.
- Offset: a message's position number in its partition. Commit offset (acknowledge) means the consumer tells the broker "I have finished everything up to here", so a restart resumes after it.
- Retry with backoff: try again after a growing wait (for example 1 s, 4 s, 16 s) rather than hammering a failing system.
- Dead-letter topic: a separate topic where messages that keep failing are parked for a human, so they do not block the rest.
- Consumer lag: how many messages a consumer is behind the newest one in its partition.
- Retention: how long the broker keeps messages (here 7 days), which also limits how far back you can replay.
- Local outbox: a table in the producer's own database where the event is saved first, then sent to the broker later, so a broker outage cannot lose it.
What the document must tell each audience
| Audience | Must know |
|---|---|
| Producers | Topic name and owner; the message key and why (ordering scope); schema and version; when a publish counts as done; behaviour when the broker is down; size and rate limits |
| Consumers | Delivery guarantee (at-least-once); ordering scope; the idempotency key; retry policy and dead-letter behaviour; how far back they can replay; consumer group naming; schema deprecation policy |
| Operators | Retention and partition count; consumer lag and dead-letter depth alerts; replay and dead-letter runbooks; capacity and quotas; who is on call |
Delivery semantics in plain terms
- At-least-once: a message is redelivered if the consumer does not acknowledge it, so duplicates are possible. It is the honest default: consumers acknowledge after processing succeeds.
- Exactly-once: across a network you cannot generally guarantee a message is delivered once. Some brokers offer transactional exactly-once inside the broker boundary, but side effects outside it (a database write, an email) still need protection. The practical claim to document is "at-least-once delivery plus an idempotent consumer", meaning processing the same message twice has the same effect as once, achieved by recording processed event ids.
- Ordering: guaranteed only within one partition (a subset of the topic's log). Choosing the key decides what stays ordered.
Diagram: partitioning, consumer groups, retry and dead-letter
flowchart LR
P[Producer] -->|key = model_name| T
subgraph T[Topic model-updates: 6 partitions, retention 7 days]
P0[Partition 0]
P1[Partition 1]
P5[Partition 5]
end
P0 --> C1[Consumer A in group scorer]
P1 --> C2[Consumer B in group scorer]
P5 --> C2
C1 -->|success: commit offset| OK[Acknowledged]
C1 -->|failure: up to 3 retries with backoff| R[Retry topic]
R --> C1
R -->|still failing| D[Dead-letter topic, 14 days]
D --> O[Alert and replay runbook]
Reading the diagram: partitions 2 to 4 are left out for readability. Trace one failing message: it arrives on partition 0, Consumer A fails to process it, so it is sent to the retry topic and comes back to Consumer A after a wait; after 3 failed retries it moves to the dead-letter topic, an alert fires, and an operator follows the replay runbook. On success the consumer commits the offset and the message is done.
Example: model-update publisher and its versioned event contract
A publisher announces each new machine-learning model version. Key by model_name so version 7 is never processed before version 6 for the same model. Consumers ignore any event whose version is not newer than the one they hold, which also makes duplicates harmless. Trace: a consumer holds version 13. Event version 14 arrives, it is newer, so the consumer applies it and now holds 14. The same event is redelivered because the acknowledgement was lost (a duplicate): 14 is not newer than 14, so it is ignored. A late version 13 arriving afterwards is also ignored.
{
"event_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"event_type": "model.updated",
"schema_version": "1.2",
"occurred_at": "2026-09-28T09:15:00Z",
"model_name": "fraud-scorer",
"model_version": 14,
"artifact_uri": "registry://models/fraud-scorer/14"
}
Schema evolution rules
- Adding an optional field is safe: old consumers ignore it.
- Removing, renaming or changing the type of a field is breaking: publish to a new versioned topic (for example
model-updates.v2) and run both for a deprecation window. - Never reuse a field name with a new meaning.
- Every event carries
schema_version; consumers must tolerate unknown fields.
Failure behaviour, stated unambiguously
| Situation | What happens |
|---|---|
| Consumer crashes mid-message | Offset not committed, message redelivered (duplicate possible) |
| Message keeps failing | Three retries with backoff, then dead-letter topic and an alert |
| Broker unavailable to producer | Publish fails and is retried by the producer; document whether the caller is blocked or the event is queued in a local outbox |
| Partition count increased | Key-to-partition mapping changes (the key is hashed then reduced by the partition count: hash 17 goes to partition 5 of 6 but partition 1 of 8), so events for one key can end up in a different partition than earlier ones and ordering can briefly break; do it in a planned window |
Pitfalls: saying "exactly-once" without saying where; a diagram with a single arrow labelled "queue"; forgetting that the dead-letter topic needs an owner and an alert, or it becomes a silent graveyard.
Draw the data flow for a payment or signup flow that crosses a frontend, a gateway, several services, a database and an external provider. Which elements and data labels do you include, and where do you mark trust boundaries?
Sample Answer
Direct answer
A data flow diagram (DFD) follows data, not services: what information moves, between which elements, and where it crosses from a less trusted zone to a more trusted one. For a signup or payment flow I draw the browser, gateway, services, database and external provider; label every arrow with the data it carries and its sensitivity; and draw dashed trust-boundary boxes around zones (internet, edge, internal network, data tier, third party). A trust boundary is any line where the level of trust changes, so it is where authentication, validation and encryption must be checked.
Elements and labels to include
flowchart LR
subgraph Z1[Zone 1: open internet]
B[Browser]
end
subgraph Z2[Zone 2: edge]
GW[API gateway]
end
subgraph Z3[Zone 3: internal services]
S[Signup service]
end
subgraph Z4[Zone 4: data tier]
DB[(User database)]
end
subgraph Z5[Zone 5: third parties]
P[Payment provider]
E[Email provider]
A[Analytics]
end
B -->|"email, password (TLS)"| GW
B -->|"card details, direct"| P
P -->|"card token"| B
GW -->|"email, password (internal call)"| S
S -->|"PII: email, name"| DB
S -->|"verification link"| E
S -->|"pseudonymous events, no email or name"| A
P -.->|"signed webhook: paid"| GW
Each dashed-box idea is drawn as a zone above (a subgraph). Any arrow that leaves one zone box and enters another crosses a trust boundary: internet to edge is boundary 1, edge to services is 2, services to data tier is 3, and services or edge to third parties is 4. (Data tier means the layer that stores data, such as databases.)
Trust boundaries I mark: (1) browser to gateway (the open internet, so validate everything and use TLS, transport encryption); (2) gateway to services (authenticated internal calls); (3) services to database (data tier, least privilege, meaning each component gets only the permissions it needs, so the signup service can insert and read users but cannot drop tables); (4) services to provider and analytics (leaving our control; outbound data must be minimised, inbound webhooks verified by signature). A webhook is an HTTP call the provider makes to our system to tell us something happened; "signed" means it carries a cryptographic signature made with a secret only we and the provider share, so we can reject forged calls.
Data labels that earn their place
Name the fields and classify them: PII (personally identifiable information: email, name), secret (password hash), payment (only a token, never the raw card number, PAN). Sending card entry straight to the provider means the PAN never crosses our boundary, which keeps our PCI DSS (card-industry security standard) scope small. Also note retention (how long each store keeps the data) and who may read each store.
Worked example: signup variant, step by step
Suppose alice@example.com signs up at 09:15:00.
- 09:15:00, boundary 1. The browser sends email
alice@example.comand her password over TLS to the gateway. The gateway checks the format, rate limit and TLS. - Boundary 2. The gateway forwards the request to the signup service with an internal service token, so only trusted callers reach it.
- Boundary 3. The signup service hashes the password (a one-way scramble, so the plain password is never stored) and writes one row: id 4821, email, name, password hash, status "unverified". The database account it uses may only insert and read the users table (least privilege).
- Boundary 4, outbound. It asks the email provider to send a verification link with a one-time token valid for 24 hours. The provider receives her email address and the link, never her password.
- Boundary 4, outbound. It emits an analytics event
{event: signup, user_id: 4821}with no email or name, because analytics does not need personal fields. Note this is pseudonymous, not anonymous: user_id 4821 can be joined back to the users table by anyone holding both, so label the flow as pseudonymous personal data and apply retention to it; truly anonymous events would carry no stable user identifier. - 24 hours later. A background job finds account 4821 still "unverified" and expires it, which enforces the retention rule.
Optional extension for machine-learning systems: real-time inference variant. Same discipline, and only needed if your system serves model predictions. A request arrives with features (model inputs, such as user_id 4821 and a country), the feature store (a database of precomputed model inputs) is read, an online model (a model kept loaded in memory so predictions are fast) returns a score, and the prediction is logged. For a training pipeline: event ingest, feature store, nightly training, then serving. Label each arrow with what data it carries, mark that raw user events are more sensitive than aggregated features, and mark boundaries where training data leaves production.
What each element should link to
Each box links to its owner, schema or data dictionary (a catalogue of each field, its meaning and its classification), runbook, and data classification; each arrow to the contract (API spec or event schema).
Trade-offs and pitfalls
- Do not draw every service call; draw only flows that carry sensitive or regulated data.
- A boundary drawn without saying what is enforced there (authentication, schema validation, encryption) is decoration.
You are writing the architecture guide for a project. Which principles would you include, how would you illustrate each with an example, and how would you tell whether teams follow them?
Sample Answer
Direct answer
I would include five to seven principles, each written in the same short form: statement, reason, example, and how we check it. If a principle cannot be checked in some way, it is a slogan and I would cut it. Adherence is measured mostly by automated checks in the build (architecture "fitness functions": tests that fail when a rule is broken), plus a light review trail through architecture decision records (ADRs: short dated notes on why something was decided), and by tagging incidents that traced back to a broken principle.
One guide entry, filled in (Principle 2)
- Statement: every remote call has a timeout and a defined fallback.
- Reason: a slow dependency without a timeout ties up threads and stalls the caller (the worked example below shows it).
- Example: the payment call times out after 2 seconds and shows "try again" instead of hanging the page.
- How we check it: a lint (an automated scan of the code for a rule violation) fails the build if a client is created without a timeout.
Example principles (each with example and check). If you can only adopt two at first, start with 1 (one owner per dataset) and 2 (timeouts), which cause the most painful incidents.
| Principle | Example | How we tell |
|---|---|---|
| 1. Each dataset has one owning service that writes it | Orders are written only by the order service; others read via its API or events | A test or dependency rule fails if another service imports the order data access code or holds credentials to that database |
| 2. Every remote call has a timeout and a defined fallback | Payment call times out after a set limit and shows "try again", never hangs the page | Lint or contract test scans clients for missing timeouts; game-day drill (a rehearsed failure, such as switching a dependency off on purpose to see what happens) |
| 3. Change APIs compatibly (add, do not break) | New optional field, old clients keep working | Contract tests (tests that replay old clients' requests against the new version) run in CI (continuous integration, the automated build and test run) |
| 4. Observable by default | Every service emits request logs, metrics and traces with a shared correlation id (one identifier passed along every call so a request can be followed across services) | Service template check; service cannot go to production without a dashboard link |
| 5. Prefer reversible decisions | Feature flags (switches that turn a change on or off without redeploying) for risky changes, expand-then-contract database migrations (add the new column first, move readers over, remove the old column last, so each step can be undone) | Review question on each ADR: "how do we undo this?" |
| 6. Secure by default | No secrets in code, least privilege (each account gets only the access it needs) for service accounts | Secret scanning (a tool that searches commits for passwords and keys) in CI, periodic access review |
How to measure following it
- Leading (a signal you can act on before harm occurs): percentage of services passing each automated check, number of open exceptions and their age. For example, if 18 of 24 services pass the timeout lint, adherence is 18 / 24 = 75%, and the 6 failing services are the work list.
- Lagging (a signal that shows up after harm): incidents whose review names a principle. If timeouts keep appearing in postmortems (written incident reviews), the principle exists but is not landing.
- Exception process: a team can break a principle by writing an ADR with an expiry date. Exceptions are visible and finite.
Worked example (illustrative)
Principle 2 (timeouts) fails in a review: the search service calls a pricing service with no timeout, and a slow pricing service stalls search. The guide's entry gives the fix pattern (timeout, retry with limit, fallback price), the check (client lint), and the owner of the exception if a team cannot comply this quarter.
Trade-offs and pitfalls
- A long list nobody remembers. Pick the few that have hurt this project.
- A guide enforced only by an architecture review board becomes a bottleneck; encode checks so teams get feedback in minutes.
- Principles must state their limits: "prefer managed services unless cost or control says otherwise", not an absolute.
Describe the lifecycle of an ADR from proposal to retirement. Who can change its status, what evidence is required, why do you supersede a decision rather than edit it, and how are impacted teams told?
Sample Answer
Direct answer
An ADR (Architecture Decision Record, a short document capturing one design decision and its reasoning) moves through Proposed, Accepted (or Rejected), then Deprecated or Superseded. The author proposes it, named deciders accept or reject it after review, and later it is retired when the assumptions behind it stop being true. Each status change is a reviewed pull request, requires stated evidence, and is announced to the teams affected. A decision is superseded, not edited, because people already acted on the original text, and an honest history is worth more than a tidy one.
The lifecycle
The diagram below is Mermaid (a text format that renders as boxes and arrows). Each box is a status and each arrow is a move between statuses, labelled with what causes it. [*] --> Proposed means every ADR starts as Proposed. Deprecated means still working but no longer recommended for new use.
stateDiagram-v2
[*] --> Proposed
Proposed --> Accepted: deciders approve
Proposed --> Rejected: deciders decline, reasons recorded
Accepted --> Deprecated: no longer recommended
Accepted --> Superseded: replaced by a new ADR
Deprecated --> Superseded: successor written
Who can change status, and what evidence is required
| Transition | Who | Evidence required |
|---|---|---|
| Proposed | Any engineer (the author) | Context, at least two alternatives, honest consequences |
| Accepted | The named deciders (for example the tech lead, plus reviewers for the change size) | Review comments resolved; test or prototype results where a claim needs them |
| Rejected | The same deciders | Reasons written down, so the idea is not re-proposed blindly |
| Deprecated | Owning team lead | A list of who still depends on it (from the service catalog, the internal directory of services and their owners) |
| Superseded | Owner of the new ADR, plus owners of affected services | What assumption broke or which revisit trigger fired (a measurable condition written into the old ADR that says when to reopen it), and a migration plan (the steps and dates for moving consumers from the old approach to the new one) |
Status changes happen through a pull request that the deciders (via a CODEOWNERS file, which routes reviews to named owners) must approve, so the change is dated, attributable and reviewable.
Why supersede instead of edit
- History: the old text explains why systems built during that period look as they do.
- Trust: if accepted ADRs can be silently rewritten, nobody can rely on them or audit them.
- Learning: the reason a decision changed is itself valuable, and it lives in the new ADR's context.
- Only typos and links get edited in place. Any change of meaning gets a new ADR with two-way links: "Superseded by ADR-0142" on the old one, "Supersedes ADR-0087" on the new one.
How impacted teams are told, and how migration is tracked
- The pull request mentions the owners of every consumer, found in the service catalog.
- A short announcement in the engineering channel and the weekly digest says what changed, why, and by when.
- Each affected team gets a ticket with a named migration owner and a deadline.
- A label or dashboard counts outstanding migrations, so "superseded" is not the end of the story until the count reaches zero.
Code-level action triggered by each state
- Accepted: create implementation tickets; add a lint rule or architecture test (an automated check that fails the build if code breaks the rule).
- Rejected: nothing in code; the record prevents re-litigating.
- Deprecated: CI warns on new use of the deprecated approach; new projects may not adopt it.
- Superseded: the check is updated to the new rule; old code paths are removed after migration; README links updated.
Worked example
ADR-0087 (accepted 2024) says "use long-lived API keys". A security review shows key leaks were a recurring issue, so the revisit trigger fires. ADR-0087 had recorded it as "reopen if more than 2 API keys leak in any quarter, review by 2025-06-30", and 3 leaked in one quarter. ADR-0142 proposes short-lived tokens, is accepted after two reviewers approve, and ADR-0087 becomes "Superseded by ADR-0142". Four consuming teams each get a ticket and a deadline (each ticket names a migration owner, the one person accountable for finishing that team's move), and CI warns on new API-key use.
Pitfalls
- Leaving ADRs "Accepted" forever. Add a review-by date.
- Marking superseded without a migration owner: the label changes but nothing else does.
- Letting the author alone approve their own ADR.
Unlock Full Question Bank
Get access to all Architecture Documentation and Communication interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.