AlgoViz

Common mistakes and self-review

easy 40 min

Most failed design interviews fail in a few familiar ways.

Video lesson · Chapter 1 of 6

Match a symptom to its repair

0:00 / 4:02

Eight mistakes and their repairs

1:30Reel coming soon

Theory

Read or listen first. About 1 min.

What it is

Most weak interviews go wrong in a few familiar ways: no scope, no finished design, no numbers, no reasons. Self-review means looking at your own attempt and finding which one it was.

It turns a bad hour into next week's exercise.

Why it exists

You cannot repair what you cannot name. A symptom such as running out of time has a cause behind it.

Reviewing a recording is uncomfortable and effective, because memory is kind to us.

A short history

  1. 1970s

    The US Army develops the after-action review: what was planned, what happened, why, what next.

  2. 1950s onwards

    Toyota's improvement work treats problems as information instead of blame.

  3. 2012

    John Allspaw of Etsy writes about blameless post-mortems in software.

Words to know

Symptom
What you notice.
Cause
Why it happened.
Repair
What you will do differently.
Drill
A small exercise for one weakness.
Scorecard
The list you check yourself against.

How it works

Step through the idea, or press Play.

Step 1 of 3

Notice. Hear the symptom, during the run or on the recording

Understand it

Start here

A team that watches its own match

A football team loses. The useful team does not only feel bad and train harder at everything. It watches the match, stops at the moment it went wrong, says why, and trains that one thing. You can do the same with a recording of yourself.

From a lost match to one drill
USTHEM01:Full time

The list

Eight mistakes, with causes and repairs

The weight is our judgement of how much each one usually costs you. It is not an official score.

SymptomWeightUsual causeRepair
Boxes before questions: "Let me start with microservices and Kafka"HighDrawing feels safer than askingWho does what, and what must never go wrong, before the first box
Five minutes of silence while drawingHighThinking and talking at once was never practisedAnnounce the pause, then say the options
One small server for a huge load, or SQLite for a social networkHighNo number was worked outPeak reads and peak writes, then decide
Kubernetes and twelve services for a form that saves a rowMediumTrying to look experiencedSmallest version, then one break, one fix
"We will use MongoDB", with no reasonMediumThe choice was a habitChoice, reason, cost, trigger
Nothing about what happens when the database is downMediumOnly the happy path was walkedFor each box: what fails, who notices, how it recovers
Twenty minutes on requirementsMediumAsking feels safeScope ends at minute 5; boxes start at 15
Crossing arrows, no labels, a cramped boardLowDrawing before deciding the layoutLeft to right, name every box, say what moves on each arrow
Poor time management moved up from small to medium: an unfinished design hides everything else you know.

From a symptom to its cause

Mistake 1

Jumping to the solution

You may design the wrong system very well. Asking first is also how the work is done: nobody can check a design against needs that were never agreed.

How it sounds

  1. Interviewer

    Design a notification system.

  2. You

    Sure. We need Kafka for queues, Redis for caching, and a microservice for each type of notification...

  3. Interviewer

    (Thinking: no question yet about which notifications, or how many.)

Repaired

  1. Interviewer

    Design a notification system.

  2. You

    Before I draw: which kinds do we send, push, email, SMS or in-app? And roughly how many a day?

  3. Interviewer

    Push and email, about 10 million a day.

  4. You

    That is 10 million over 100,000, so about 100 a second, and 300 at peak. That is modest. The hard part is more likely retries without sending twice than raw size.

Mistake 2

Going silent

The interviewer can only credit what you say or draw, and can only help if they know where you are. A pause is fine when you announce it. Two silent minutes are not.

How it sounds

  1. Interviewer

    How would you handle the data storage?

  2. You

    ... let me think ... (two minutes later) We will use PostgreSQL.

Repaired

  1. Interviewer

    How would you handle the data storage?

  2. You

    Let me think about how the data is used. People write posts and read feeds. I will assume 100 reads for each write. Posts have a clear shape, so a relational database such as PostgreSQL fits, and one write is easy to make correct.

  3. You

    The feed needs fast reads. If the number demands it, I would keep prepared feeds in Redis, which can be rebuilt from the database. The cost is a feed that is a few seconds old. Does this direction make sense?

Mistake 3

Ignoring the scale, or guessing it

Designing for 100 users when the prompt said 100 million is a mistake. So is jumping to the largest design because the number sounds large. Work it out, then decide.

How it sounds

  1. Interviewer

    We need this to handle 500 million monthly active users.

  2. You

    OK. One web server connected to a single MySQL database...

  3. Interviewer

    (Thinking: how many requests is that? Did they check?)

Repaired

  1. Interviewer

    We need this to handle 500 million monthly active users.

  2. You

    I will assume 10% are active on a given day, so 50 million, with 10 requests each. That is 500 million a day, about 5,000 a second by dividing by 100,000, and 15,000 at peak. Is 10% fair?

  3. Interviewer

    Fine. Reads or writes?

  4. You

    Mostly reads, say 100 to 1: about 150 writes a second at peak. So I need several copies of the service behind a load balancer, and a cache or replicas for reads. 150 writes do not need sharding yet. Total storage may, so I will check that next.

The same sum, written down

500,000,000×10%×10100,000=5,000/s,5,000×3=15,000/s at peak\frac{500{,}000{,}000 \times 10\% \times 10}{100{,}000} = 5{,}000/\text{s}, \qquad 5{,}000 \times 3 = 15{,}000/\text{s at peak}
With 86,400 seconds it is 5,787 a second and about 17,400 at peak. Both lead to the same decision.

Mistakes 4 to 6

Judgement: too much, no reason, no failure

Over-engineering, and the repair

  1. Interviewer

    Design a URL shortener.

  2. You

    (Bad) Kubernetes with 15 microservices, events in Kafka, an Istio mesh, GraphQL federation, and a blockchain for ownership of URLs.

  3. You

    (Better) At its core this is a small, read-heavy service: a map from short code to long URL. I will begin with the simplest thing that works and add parts when a number asks for them.

A choice with no reason, and the repair

  1. You

    (Bad) For the database, MongoDB.

  2. Interviewer

    Why MongoDB?

  3. You

    (Bad) It is popular and scalable.

  4. You

    (Better) I compared two. Posts and users are related, which suits a relational database. But the main read is one post by its key, and at the size we worked out it will outgrow one machine. So posts go in a key-value store such as DynamoDB, and accounts stay in PostgreSQL, where I want constraints and transactions across tables. The cost is two systems to run. If the total stayed under a few terabytes I would keep everything in PostgreSQL.

Failures to raise before they ask

PartWhat failsSay
Service copyIt crashes in the middle of a request"The client retries with the same key, so it happens once."
DatabaseThe primary dies"A standby takes over. For about a minute we refuse writes and serve cached reads."
CacheIt is empty after a restart"Reads go to the database, so I limit them and warm the hot keys."
NetworkA reply is lost after the work was done"The caller cannot tell, so the call must be safe to repeat."
DiskIt fills up"Alert at 70%, and delete or archive by age."
The minute and the 70% are assumptions. Say yours.

Mistakes 7 and 8

Time and the picture

Where the minutes should be

Phase45 minutesLate when
Scope0 to 5Still asking at 7
Numbers5 to 10A sum with no "so"
API and data10 to 15Listing fields
Design15 to 25No box at 17
Deep dives25 to 40Main path not working at 27
Wrap-up40 to 45New idea at 41
5 + 5 + 5 + 10 + 15 + 5 = 45.

A picture people can follow

  • Names: client app, load balancer, API server
  • Arrows that say what moves: HTTPS request, seat query
  • One direction, left to right or top to bottom
  • Same shape for the same kind of part
  • A short legend if you use colour, so colour is never the only clue
  • Redrawn when it gets messy

A picture that hides the design

  • Boxes called "Thing", "DB?" or "???"
  • No arrows, or arrows that cross everywhere
  • Everything squeezed in one corner
  • A label on every byte, so nothing stands out

The same four parts, drawn clearly

Phase by phase

Do and do not

Scope: do

  • Ask before designing
  • Separate features from quality targets
  • Say what is out
  • Put numbers on users, requests and data
  • Say the scope back in one sentence

Scope: do not

  • Assume you understood
  • Skip to boxes
  • Ask only yes or no questions
  • Forget speed and scale
  • Go past five minutes (seven in an hour-long interview)

API and design: do

  • Agree the calls before the insides
  • Give the reason with each choice
  • Weigh more than one approach
  • Draw named boxes and follow one request
  • Check in: "Does this make sense?"

API and design: do not

  • Fall into low-level code
  • Think in silence
  • Offer one option as the only one
  • Draw vague boxes
  • Name a product you cannot explain

Deep dives: do

  • Offer two and let them choose
  • Say the trade-off
  • Fix the part that fails a target
  • Cover failure and recovery
  • Use a quick sum

Deep dives: do not

  • Ignore a hint
  • Speak in absolutes
  • Hide from what you do not know
  • Add complexity for its own sake
  • Forget how you would know it is broken

Talking: do

  • Say your reasoning as you go
  • Announce each change of phase
  • Welcome feedback and adjust
  • Speak in clear parts
  • Use specific numbers

Talking: do not

  • Stay silent for long
  • Ignore feedback
  • Get defensive
  • Ramble
  • Use words you cannot explain

Five rules if you remember nothing else

  • Communicate

    They can only credit what they hear or see.

  • Ask first

    Needs before boxes.

  • Name the cost

    Every choice gives something up.

  • Keep a structure

    Six phases, said out loud.

  • Justify

    Choice, reason, cost, trigger.

Recover

Five bad moments and what to say

Nobody expects perfection. Noticing a problem, saying it and adjusting is part of the job, so it is part of what is observed.

1. You misunderstood the requirement

  1. 1

    Stop and say it

    "Let me go back to a requirement."

  2. 2

    Ask the one question

    Not five. The one that changes the design.

  3. 3

    Restate and continue

    Say what you now understand and what changes.

  1. You

    Wait, I want to go back to something. I have been designing for delivery in real time, and I should have confirmed it. Do all notifications need to arrive at once, or may email come later as a digest?

  2. Interviewer

    Good catch. Push should be immediate. Email can be batched every hour.

  3. You

    That changes it. I will use two paths: an immediate one for push, where we promise to hand the message to the push provider within a second, and an hourly batch for email. We cannot promise when a phone that is off will show it.

2. You do not know a technology

  1. 1

    Be honest

    "I have not used it."

  2. 2

    Say the idea you need

    The property, not the product.

  3. 3

    Offer what you know

    And ask which they prefer.

  1. Interviewer

    Have you considered Apache Pulsar for this?

  2. You

    I have not worked with it. I understand it is a messaging system that can move old data to cheaper storage. What I need is durable messages, kept in order for each customer, at about 300 a second. I know Kafka better and it meets that. Shall I go on with Kafka, or would you like to explore what Pulsar would change?

3. You are stuck

  1. 1

    Say what you are stuck on

    One sentence.

  2. 2

    Make it smaller

    What would the simplest version do?

  3. 3

    Start from what you know

    Then ask for a hint if you need one.

  1. You

    I am thinking about ranking the feed. Let me split it. We have likes, comments and how recent the post is. I am not sure of the best formula, but I need one score. May I start with a weighted sum and then discuss how to improve it?

  2. Interviewer

    That is a good place to start.

4. They challenge your design

  1. 1

    Listen to the end

    It is a joint design, not an attack.

  2. 2

    Say what is right in it

    Name the case where it hurts.

  3. 3

    Decide

    Change the design, or defend it with a number.

  1. Interviewer

    You read from a replica that may be behind. What if two people see different states?

  2. You

    For payments that is a real problem. I would read and write the balance on the primary, in one database transaction, with an idempotency key so that a retry charges once. The cost is more load on the primary. For the list of notifications, a second of delay is fine, so it stays on the replica.

5. You are running out of time

  1. 1

    Say so

    "We are close on time."

  2. 2

    Summarise what works

    Decisions with reasons, then the weak point.

  3. 3

    Say what comes next

    And offer them the choice.

  1. You

    We are close on time, so let me summarise. Copies of a stateless service, one database with read replicas for the 15,000 reads a second at peak, and a CDN for images. The weak point is the single primary. With more time I would cover monitoring and test a failover. Would you like me to touch on either?

Stuck? Keep moving

In the room

Four habits that prevent most mistakes

Structure what you say

  1. 1

    Six phases as a backbone

    Scope, numbers, API, design, deep dives, wrap-up.

  2. 2

    Announce changes

    "Now the high-level design."

  3. 3

    Summarise often

    "So far, X handles Y through Z."

  4. 4

    Number your points

    "Two reasons. First..."

  5. 5

    Always a why

    Every decision has a spoken reason.

Summing up before moving on

  1. You

    Let me sum up. A chat system: one-to-one messages, groups, and delivery to people who were offline, with messages stored. Read receipts later if there is time. Does that capture it?

  2. Interviewer

    Yes. Let us move on.

  3. You

    Then two or three numbers, the API, a design that works end to end, and a deep dive on delivery, which I think is the interesting part.

Bring the interviewer in

  1. 1

    Check in

    "Does this make sense so far?"

  2. 2

    Offer a choice

    "Deeper here, or move on?"

  3. 3

    Take hints at once

    They are usually pointing at the hard part.

  4. 4

    Design together

    It is a pair session, not a speech.

  5. 5

    Look up sometimes

    On video, a glance at the camera helps if it is comfortable for you. Clear speech matters more.

Taking a hint

  1. You

    I would write each new post into followers' feeds as it is posted. Before I go on, does that fit what you had in mind, or shall I explore building the feed when it is read?

  2. Interviewer

    Writing ahead is interesting. What about an author with 10 million followers?

  3. You

    Then one post means 10 million writes. I would mix: write ahead for ordinary authors, and for very large ones fetch their posts when the feed is read. The cost is a second path to keep correct.

Draw as you talk

  1. 1

    Start at the user

    Left to right or top to bottom.

  2. 2

    Same shape, same kind

    Rectangles for services, cylinders for databases.

  3. 3

    Label what matters

    Every box name, and what moves on each arrow. Protocols and formats only where they matter.

  4. 4

    Colour by kind

    Stores, services and queues may differ, with names as well.

Handle pressure

  1. 1

    Pause out loud

    "Let me think about this for a moment."

  2. 2

    Say what you weigh

    "I am choosing between A and B."

  3. 3

    Slow down

    Nerves speed you up, and speed makes errors.

  4. 4

    Assume good will

    Most interviewers would like to see you do well.

  5. 5

    Own mistakes

    Say it plainly, change it, go on.

Thinking aloud under pressure

  1. You

    Let me take a moment on the schema. I want the relations right.

  2. You

    Two options. A: separate tables for users, posts and likes with foreign keys. B: one document per post with its likes inside. Likes change all the time and I need several kinds of query, so I prefer A, with read replicas because most traffic is reads. The cost is a join, and replicas that can be a little behind. If the only query were "one post by id", I would choose B and keep likes as a counter.

Score it

The scorecard

Sixteen points in four groups. Give each 0, 1 or 2. The weights are a practice aid of ours. Companies use their own forms.

Requirements, 20%: can you scope before you solve?

Point012
Clarifying questionsNoneA fewThe ones that change the design
FeaturesMissed mostThe basicsAbout three, agreed
Quality targetsIgnoredMentionedWith numbers: load, latency, storage
ScopeNoneVague edgesClear in and out

Design, 30%: can you build the whole?

Point012
APINoneBasic callsA call per feature, with the main fields
PartsKey ones missingMostAll needed, each with one job
Data flowUnclearPartlyOne request followed, arrows labelled
ChoicesNo reasonSome reasonsReason and cost

Depth, 25%: can you go further?

Point012
Trade-offsNoneMentionedOptions, choice, cost, trigger
Edge casesIgnoredWhen askedRaised by you
GrowthNone"Add servers"What breaks first, with the fix for that
FailureNone"It may fail"Who notices and how it recovers

Communication, 25%: could a team work with you?

Point012
ThinkingSilentPartly clearOut loud, pauses announced
PictureNone or messyBasicNamed boxes, labelled flow
TimeRan outRushed endAll six phases
FeedbackDefensiveAccepted quietlyChanged the design, or defended it well

A weighted score

68×20+58×30+48×25+78×25=15+18.75+12.5+21.875≈68\frac{6}{8}\times 20 + \frac{5}{8}\times 30 + \frac{4}{8}\times 25 + \frac{7}{8}\times 25 = 15 + 18.75 + 12.5 + 21.875 \approx 68
An example with 6, 5, 4 and 7 points of 8. Depth has the lowest share, 50%, so depth is the next drill, whatever the total says.

Watch it back

Review your own recording

Three passes, about 75 minutes in all

  1. 1

    Pass 1: play it, 45 min

    Do not stop. Note only minutes and one word: "17 boxes", "24 silent", "31 hint".

  2. 2

    Pass 2: mute it, 10 min

    Jump to minutes 10, 25 and 40. Read only the board. Can you follow the main path?

  3. 3

    Pass 3: listen only, 15 min

    Replay the three worst minutes. Write what you said and what you wish you had said.

  4. 4

    Three lines, 5 min

    Symptom, cause, repair. Choose one drill and a date.

Questions for afterwards

What went well?What needs work?
Which phases felt smooth?Where did I get stuck or go silent?
Where was my reasoning clear?Which ideas was I unsure of?
Which questions were worth asking?Did I keep time in every phase?
Which surprise did I handle calmly?Which hints did I miss?

From the recording to next week

Repair it

Turn a weakness into next week's drill

A good drill is small, repeated and can be passed or failed.

WeaknessDrillPass when
Boxes too earlyFive prompts, five questions only, two minutes eachYou name the hard part each time
SilenceSolve a puzzle aloud for five minutes a dayNo gap over 15 s without saying so
No numbersThree prompts: peak reads, peak writes, storageEach ends with "so"
Over-buildingRemove one box from an old design at a timeYou name the target that fails, or leave it out
No reasonsTen choices on cards: reason, cost, triggerTwenty seconds each
Happy path onlyOne old design, kill each box in turnWho notices and how it recovers, for all
LateShort version of a design in five minutes, three promptsMain path works on the board
Messy boardRedraw one design in three minutesA friend can follow it without you

Worked example 1: recipe sharing, no boxes at minute 25

  1. 1

    Symptom

    Pass 1 note: "25, still on API. Nine endpoints."

  2. 2

    Cause

    I listed a call for every idea, because I had agreed seven features.

  3. 3

    Repair

    Three features: post a recipe, save it, search by what is in the kitchen. One call each.

  4. 4

    Drill

    Three prompts, ten minutes: three features, three calls, one record. Monday, Wednesday, Friday.

  5. 5

    Check

    Next run: first box at minute 16. Passed. Next weakness: no costs.

Worked example 2: ride hailing, "why Redis?" went badly

  1. 1

    Symptom

    Pass 3: I said "because it is fast" and then nothing for twenty seconds.

  2. 2

    Cause

    I knew the choice but had never said the reason aloud. Habit, not knowledge.

  3. 3

    Repair

    "A million drivers every 3 seconds is about 333,000 small writes. Losing one costs nothing, because the next comes in 3 seconds. So memory, not the trip database. If we had a thousand drivers, the database would do."

  4. 4

    Drill

    Ten choice cards, four parts each, aloud, twenty seconds. Day 1, 3 and 7.

  5. 5

    Check

    Next mock: the peer asks "why" five times. Five answers with a number or a cost.

Watch four runs (an example, not a typical result)

RunRequirementsDesignDepthCommunicationDrill after it
14/83/82/85/8Short version in five minutes
25/85/82/86/8Kill each box
36/85/84/86/8Choice cards
46/86/85/87/8Two dives on a new prompt
Each drill goes to the lowest share at that moment. Run 1 is the exception: depth was lowest, but without a finished design there is nothing to go deep on, so finishing came first.

Before it starts

A preparation checklist

One week beforeOne day beforeOne hour before
Review the main building blocks: databases, caching, load balancing, queuesLight review only. Nothing newRead the six phases and their minutes
Do two or three prompts end to endQuiet room, good light, steady internetWater within reach, and a snack if you like
Set up a whiteboard or a drawing toolTest screen sharing and the tool they useClose what you do not need
Book one or two mocksTwo or three questions to ask themOpen the drawing tool
Read the six phasesLook over your own sheet of parts and when to use themJoin five minutes early to test sound and picture
Practise the sums: users, requests a second, storageSleepA few slow breaths. It is a conversation
The plan for longer preparation is in Study plans. The day itself is in Interview day.

What a prepared opening sounds like

  1. Interviewer

    Today we will do system design. Please design a URL shortener like TinyURL. You have about 45 minutes.

  2. You

    Thank you. I would like a few minutes on the requirements first. May I ask some questions?

  3. Interviewer

    Of course.

  4. You

    How many new links a day? Is it fair to assume about 100 opens for each link made? And do people choose their own short names, or are they always generated?

Prompts to practise on

PromptWhat it exercisesOn this site today
URL shortenerShort unique codes, key lookups, many readsFull page, Mock and whiteboard
Rate limiterCounting in windows, shared countersWhiteboard
News feedFan-out, caching, rankingWhiteboard
ChatOpen connections, delivery, orderPractise with a peer
NotificationsQueues, priorities, templates, retriesPractise with a peer; see the Mock here
Video streamingCDN, encoding, adaptive bitratePractise with a peer
More full case studies are coming. The old list graded these easy, medium and hard. We dropped that, because any of them can be as hard as the follow-ups.

Ways to practise

WayGood forCost
Mock with a friend or colleagueInterruptions and real questionsFree
Record yourselfPace, silence, the boardFree
Write a one-page designOrdering your thoughtsFree
Mock interview services, such as Pramp or interviewing.ioStrangers and more experienced interviewersVaries. Check what each offers now

Summary

The whole topic in one minute.

Name the symptom, find the cause, choose one repair and drill it.

Score the same things each time, so you can see change.

  • Symptom, cause, repair. Only a repair can be practised.
  • Ask, say it aloud, work out the number: the first three repairs.
  • Choice, reason, cost, trigger for every decision.
  • Saying a mistake plainly beats hiding it.
  • Three passes over the recording, three lines, one drill.
  • The lowest share chooses the drill.

Sources