Answering 'What's the Difference Between X and Y' Cleanly
"What's the difference between a stub and a mock?" Questions like this make people either freeze or dump everything they know. A tiny four-step pattern keeps you calm and clear.
The idea, in one line
Answer in four short beats: Definition, Trade-off, Example, Limit. Same four beats every time, for almost any "compare X and Y" question.
The four beats
- Definition — one clean sentence. Show you know what the thing is before you have opinions about it.
- Trade-off — what it gives you, and what it costs. Strong engineers talk in trade-offs, so say the cost out loud.
- Example — tie it to something you actually tested. Real examples are what separate memorised definitions from real experience.
- Limit — where it breaks down. Naming the weak spot yourself signals good judgement.
See it work
Here's the skeleton with a worked answer for "mock vs stub" underneath.
[DEFINITION] "A ___ is ___."
[TRADE-OFF] "It gives you ___, at the cost of ___."
[EXAMPLE] "On ___ I used it to ___, which meant ___."
[LIMIT] "Where it breaks down is ___, so I'd pair it with ___."
# Worked example - "mock vs stub?"
# DEF: A stub returns canned data; a mock also checks it was called.
# TRADE: Mocks verify the call, but tie tests to how code works inside.
# EX: I mocked the email service to check send() fired once on signup.
# LIMIT: Too many mocks = tests pass while the real wiring is broken.Read it top to bottom: you defined it, weighed it, gave a real example, then named the catch. That sounds like someone who has actually used the thing.
Advanced — it buys you thinking time
There's a hidden bonus. While your mouth delivers the definition, your brain quietly lines up the example. The structure does some of the thinking for you.
Grounded in the System Design Handbook article on explaining tradeoffs in interviews
All lessons in Final Preparation: The Big-Company Question Bank
- STAR: A Frame for Every 'Tell Me About a Time' Answer
- Pick the Right Story Before You Start Talking
- Answering 'What's the Difference Between X and Y' Cleanly
- The 4-Minute 'Walk Me Through Your Framework'
- System-Design Questions for Testers, Step by Step
- Handling 'I Don't Know' and Curveball Questions