Skip to content

Lesson 9 of 9 · 29m

Scenario Drills: From Interview Diagram to Production Design Doc

Practice realistic designs for URL shortening, feeds, and collaborative editing, then convert the result into a document a team can build and operate.

The final skill is synthesis. Anyone can memorize a URL-shortener answer. Real interviews and real architecture reviews mutate the scenario: add abuse, add tenants, add privacy, add a tiny team, add a region outage. Practice by keeping the skeleton stable and letting constraints change the organs.

Drill one: URL shortener

Start with the narrow skeleton:

requirements: create short links, resolve quickly, count clicks, disable abuse
read path:     edge/cache -> redirect service -> key-value store
write path:    API -> validate destination -> allocate key -> metadata store
abuse:         rate limits, destination scanning, takedown invalidation

Now mutate it. If links are private tenant assets, cache keys and authorization change. If custom aliases matter, uniqueness and reservation invariants matter. If click analytics become near-real-time, the write path fans out to an ingestion pipeline. A single architecture no longer fits every version.

Drill two: news feed

Feeds expose fan-out economics:

fan-out on write:  publish once, copy to follower feeds
fan-out on read:   read candidate posts and assemble feed per request
hybrid:            precompute normal users, assemble celebrities dynamically

The tradeoff is storage and write amplification against read latency and freshness. Add ranking and the system gains feature pipelines, model inference, experimentation, and feedback loops. Add moderation and deletion, and precomputed copies need propagation rules.

Drill three: collaborative editing

This scenario punishes hand-waving. Requirements include presence, concurrent edits, permissions, offline behavior, history, and conflict resolution. Key decisions:

source of truth       document metadata plus operation log or CRDT state
transport             websocket session, reconnects, backoff
consistency           operation ordering, transformation or CRDT merge
authorization         every reconnect and document join checked
persistence           snapshots plus operations, compaction policy

Do not claim websockets solve collaboration. They are transport, not conflict semantics. A practical first version may centralize ordering through a document service, while accepting that scaling very hot documents needs careful partitioning.

Convert the answer into a production design doc

A useful document structure is boring and powerful:

1. problem and non-goals
2. requirements and measurable service objectives
3. capacity estimates and peak assumptions
4. data model, ownership, and invariants
5. critical workflows with sequence diagrams
6. component choices and rejected alternatives
7. failure modes, security/privacy risks, abuse cases
8. rollout, migration, observability, and operational plan
9. open questions and explicit decision deadlines

The document should let a new engineer answer: what are we building, what can break, what data is authoritative, how do we know it works, and what do we do first?

Practice like an operator

Timebox the drill. Spend ten minutes on requirements, five on estimation, ten on data and workflows, ten on components and failure, five on tradeoffs and summary. Then review what changed when a constraint mutated. The goal is not a perfect diagram. The goal is a repeatable thinking process that survives missing information.

Field notes

  • Interview scenarios are easier when you treat them as production systems with users and attackers rather than puzzle prompts.
  • Never let component names substitute for data ownership, consistency, and failure semantics.
  • A design doc that hides open questions creates implementation meetings later; write them down while they are cheap.
  • Practice explaining the same system at three altitudes: executive summary, component walkthrough, and incident behavior.

Was this lesson helpful?

Sign in to rate