19.1 A Structured Approach for “Design X” Interview Questions
Architect-level interviews frequently include an open-ended “design a system for X” prompt. The differentiator between a senior engineer’s answer and an architect’s answer is structure and explicit tradeoff reasoning, not just knowing more patterns. Use this sequence:
1. CLARIFY SCOPE & REQUIREMENTS (2-3 minutes)
- Functional requirements: what must the system do?
- Non-functional requirements: scale (RPS, data volume), latency SLA,
availability target, consistency needs, compliance/regulatory constraints
- Explicitly state assumptions you're making if the interviewer doesn't answer
2. IDENTIFY THE CORE DOMAIN & KEY ENTITIES
- What are the main aggregates/bounded contexts?
- What's the primary read path vs primary write path?
3. HIGH-LEVEL ARCHITECTURE (draw it)
- Client → Gateway → Services → Data stores, at a coarse level
- Sync vs async boundaries — where does the request wait, where doesn't it?
4. DEEP DIVE ON THE HARD PART
- Every design question has ONE part that's actually interesting
(a hot partition, a consistency requirement, a scale cliff).
Identify it early and spend most of your time there.
5. DATA MODEL & STORAGE CHOICE
- Justify SQL vs NoSQL, schema sketch, indexing strategy for the hot queries
6. SCALING STRATEGY
- Where does this break first as load grows 10x/100x?
- Caching layers, read replicas, sharding, async offload
7. RESILIENCE & FAILURE MODES
- What happens when [dependency] is down? Circuit breakers, fallbacks,
graceful degradation, retry/backoff
8. TRADEOFFS — STATE THEM EXPLICITLY
- "I chose eventual consistency here because X, at the cost of Y"
- This is the single highest-signal thing you can do in the interview —
it demonstrates you know there ISN'T a universally correct answer
9. WRAP UP
- Summarize the design in 2-3 sentences
- Proactively name what you'd want to validate/prototype if this were real
Common failure modes to avoid: diving into low-level implementation (specific SQL syntax, class names) before the high-level shape is agreed; designing for a scale nobody asked for (“let’s use Kafka and 50 microservices” for a system with 10 RPS); never stating a tradeoff, which reads as “doesn’t understand there are alternatives”; ignoring non-functional requirements entirely and only describing the happy path.
19.2 Architecture Decision Record (ADR) Template
An ADR is a short, version-controlled document capturing one significant architectural decision, its context, and its consequences — the single most effective habit for making architecture decisions auditable and revisitable rather than tribal knowledge that erodes as people leave.
# ADR-0012: Use the Transactional Outbox Pattern for Order Event Publishing
## Status
Accepted (supersedes ADR-0004 which used direct dual-write)
## Context
The Order service must publish an OrderCreated event whenever an order is
persisted, so downstream services (Shipping, Analytics, Notifications) can
react. The current implementation writes to the database and then calls the
message broker directly — if the broker call fails after the DB commit
succeeds, downstream services never learn about the order, causing silent
data inconsistency. This has caused 3 production incidents in the last
quarter (INC-4471, INC-4502, INC-4588).
## Decision
We will adopt the Transactional Outbox pattern: the OrderCreated event is
written to an OutboxMessages table in the SAME database transaction as the
Order write. A background worker polls unpublished outbox rows every second
and publishes them to Kafka, marking them processed on success.
## Alternatives Considered
1. **Two-phase commit (2PC/XA)** — rejected: Kafka doesn't support XA
transactions; would also introduce blocking behavior and reduce
availability.
2. **CDC via Debezium reading the WAL directly** — rejected for now: lower
latency than polling, but adds a Kafka Connect + Debezium operational
dependency the team isn't yet staffed to run. Revisit if outbox latency
(currently ~1s) becomes a problem.
3. **Do nothing / accept the current risk** — rejected: incident frequency
and customer impact are unacceptable.
## Consequences
- **Positive**: DB write and event publication become atomic; eliminates the
dual-write failure class entirely.
- **Positive**: outbox table doubles as a natural audit log of all published
events.
- **Negative**: adds ~1 second of latency between DB commit and event
publish (poll interval) — acceptable for this use case, would NOT be
acceptable for a sub-100ms real-time requirement.
- **Negative**: requires a new background worker process to operate and
monitor (alert if outbox backlog grows unexpectedly).
- **Follow-up**: add a scheduled cleanup job to archive processed outbox
rows older than 30 days.
## Related
ADR-0004 (superseded), RFC "Order Service Event Contract v2"
19.3 Interview Q&A
Q1: Walk me through how you’d answer an open-ended “design X” interview question.
I follow a fixed structure so I don’t miss anything under time pressure and so the interviewer can see my reasoning, not just my conclusion. First, clarify scope and both functional and non-functional requirements — scale, latency, availability, consistency needs — and state my assumptions out loud if they’re not given. Then identify the core domain and its key entities/bounded contexts before drawing anything. Sketch the high-level architecture at a coarse level — client, gateway, services, data stores — and mark the sync/async boundaries. Then I deliberately find the one genuinely hard part of the problem (every design question has one — a hot partition, a tricky consistency requirement, a scale cliff) and spend most of my remaining time there rather than spreading evenly across trivial parts. I close by stating my tradeoffs explicitly — what I optimized for and what I gave up — because that’s the single highest-signal thing in the whole exercise: it shows I know there isn’t one universally correct answer.
Q2: Why do you write ADRs, and what goes wrong without them?
Without a written record, architectural decisions live in people’s heads and Slack threads, which means six months later nobody remembers why a particular tradeoff was made, and a well-meaning engineer “fixes” something that was actually a deliberate decision — or worse, the same debate happens again from scratch. An ADR captures the context (what problem, what constraints), the decision itself, the alternatives that were seriously considered and why they were rejected, and the consequences — including the negative ones, stated honestly. That last part matters most: an ADR that only lists benefits isn’t useful later when someone’s trying to decide whether the tradeoff still holds under new circumstances.
Q3: An interviewer asks you to “design a URL shortener” — how do you avoid over-engineering or under-engineering the answer?
I resist jumping straight to Kafka/microservices/sharding, and I resist staying purely at “insert into a table” level too — the calibration comes from stating assumptions and asking for scale numbers if not given (e.g., “should I assume Twitter-scale, ~100K writes/sec, or a smaller internal tool at ~10 writes/sec? I’ll assume the former unless told otherwise”). For a URL shortener specifically, the actually interesting parts are: the ID-generation strategy (auto-increment + base62 encoding vs a distributed ID generator like Snowflake, and the tradeoffs of each under multi-region writes), the read-heavy access pattern (redirects vastly outnumber creates, so aggressive caching and read replicas matter far more than write scaling), and cache/DB consistency for a custom-alias collision check. I’d spend most of the interview time on those, not on drawing generic boxes for “load balancer → app server → database” that don’t differentiate this problem from any other.