← Back to the map

Unit 0 · Lesson 2

The 6-step approach

"Design a photo-sharing app." Forty-five minutes on the clock. Where do you even start?

By the end you can

Watch

Prefer reading? The same lesson is written out below.

A design question is deliberately vague. "Design a photo-sharing app" could mean a weekend project or a global service. The worst move is to start drawing servers. The best move is a simple, repeatable plan.

1 Requirements2 Estimates3 API4 Data model5 High level6 Deep dive
Six steps in order: 1 requirements, 2 estimates, 3 API, 4 data model, 5 high-level design, 6 deep dive.
  1. Requirements. What must it do, and how well?
  2. Estimates. How many users, requests and bytes? Rough numbers are fine.
  3. API. What calls do clients make? uploadPhoto, getFeed, follow.
  4. Data model. What do we store, and how is it related?
  5. High-level design. The boxes and arrows: clients, servers, storage, caches, queues.
  6. Deep dive. Pick the hardest parts and go deeper: the feed, the bottleneck, what fails.

Requirements come in two kinds

Non-functional requirements drive most design choices. "Never lose an upload" means storing copies in more than one place. "Feed in 200 ms" probably means a cache.

Why this order?

Each step feeds the next. You can't size a database before you know how much data there is, and you can't know that before you know what users do. Skipping straight to boxes produces a design for a problem nobody stated, and it's hard to defend any choice in it.

The order also keeps you honest about time. If you spend 30 minutes on requirements, there's no time for the deep dive, which is usually where the interesting trade-offs live. A rough split for 45 minutes: 5 on requirements, 5 on estimates, 5 on API and data, 15 on the high level, 15 on the deep dive.

Key idea: requirements, estimates, API, data model, high level, deep dive. Ask before you draw, and let the numbers and the non-functional requirements decide the design.

Check yourself

Put this course's six steps in order.

  1. 1Estimates
  2. 2Requirements
  3. 3High-level design
  4. 4Data model
  5. 5Deep dive
  6. 6API

Your new flashcards

Practice them now. With a free account they come back in your daily review.

Card 1 of 3