Junior, mid and senior answers
medium 45 minThe same prompt is given to people with two and with twelve years behind them.
Video lesson · Chapter 1 of 6
Make a prediction
Junior, mid and senior answers
1:02Reel
Theory
Read or listen first. About 2 min.
What it is
A design round is usually the same prompt for every level. A parking lot, a card, an elevator. The interviewer does not ask a harder question to a senior person. They listen for different things in the answer.
Levels are best seen as questions that a person asks without being told. Junior: does it work? Mid: does it stay correct when used in a way I did not plan? Senior: what happens when something fails or when two things happen at once? Staff: is this the right thing, and how does it change over years?
Each level contains the one before it. A staff answer that does not run is not a staff answer. This is why the code on this page grows: nothing is thrown away.
Why it exists
Many people prepare one level too high or too low. A junior who talks about distributed locks and has no working code loses both. A senior who stops at clean classes looks like a mid.
It helps to know what is not expected of you. Time is fixed at about 45 minutes. Depth in the things of your level beats a list of words from the next one.
And it gives you a way to grow. The gap between two levels is a small set of habits that you can practise on any problem.
A short history
1980
Stuart and Hubert Dreyfus describe five stages of learning a skill in a report at Berkeley. Beginners follow rules, experts see what matters in the situation.
2018
CircleCI rebuilds its engineering competency matrix, three years after its first one, and publishes how it was done.
2023
Dropbox publishes an update of its engineering career framework and explains why it was changed.
Words to know
- Level
- How much uncertainty a person handles alone. Titles differ between companies.
- Signal
- Something you said or wrote that an interviewer can note down.
- Scope
- How far your care reaches: a method, a class, a service, years.
- Edge case
- An input at the border of what is allowed.
- Failure case
- Something outside your code goes wrong: a retry, a crash, a second thread.
- Ledger
- A list of facts that is only added to. The balance is computed from it.
- Idempotent
- Doing it twice has the same effect as doing it once.
- Trade-off
- A choice with its price said aloud.
- Leveling down
- Being offered a lower level than the one you applied for.
How it works
Step through the idea, or press Play.
Junior. Does it work?
Understand it
Start here
Four builders repair one fence
Sam's fence has three broken boards. Sam asks four builders, on four different days, with the same sentence: please repair my fence.
Boards, gate, post, steps. Works, usable, solid, right.
The map
What each level shows
Same 45 minutes, different signals
| Part of the round | Junior | Mid | Senior | Staff |
|---|---|---|---|---|
| Questions | What should it do? | Limits, wrong input, who uses it | How often, how many at once, what must never happen | Why do we need it, who pays for mistakes, what comes next year |
| Entities | The nouns of the prompt | Rejects some, gives each rule an owner | Separates facts from computed values | Separates what changes at different speeds |
| Code | Runs, good names | Private state, checks before changes | Atomic steps, time handed in, tests for failure | Small contracts, versions, room to remove |
| Errors | One check | Refuses with a reason | Retries, partial failure, idempotency | Limits the damage, plans repair |
| Tests | Happy path by hand | Borders | Race, retry, clock | Old and new rule side by side |
| Extension | Can do it when told how | Shows the one place | Shows the cost | Says whether to do it at all |
| Talk | Explains what | Explains why | Explains why not | Explains what would change the decision |
Where to spend the minutes
The prompt
A stamp card for a coffee shop
The prompt: design a loyalty card. A customer gets a stamp for each drink. Ten stamps give a free drink. It is small enough to write four times, and deep enough to show all four levels. Before you read on, spend two minutes on your own questions.
Questions the four people ask
| Level | First questions | What the answers change |
|---|---|---|
| Junior | One stamp per drink? Exactly ten? | Two numbers in the code |
| Mid | Can a free drink earn a stamp? May one card be used in two shops? What if someone redeems with nine? | A rule object, a map of cards, clear refusals |
| Senior | What if the till sends the same sale twice? Two tills with one card? Refunds? Do stamps expire? | Receipt ids, a ledger, a lock, a clock |
| Staff | Why do we give free drinks? What if marketing changes ten to eight next month? Who loses when a bug gives away drinks? | Dated rules, a limit, a way to compare old and new, and perhaps a smaller design |
Level 1
The junior answer
It works, it is short, and it can be read by anybody. That is a good answer. Its weakness: everybody can write stamps, and the number ten appears where it is used.
Junior: one class, open to everybody
1/2The asked thing
A till calls buy, the card counts, redeem gives a free drink at ten.
uses
Level 2
The mid answer
Nothing new is promised to the customer. What changes is who may touch what: the number is private, the rule has a name, and callers go through one door.
Mid: each rule has an owner
1/3The card guards its number
Private stamps, two methods, and no way below zero.
owns (dies together)usesdepends on
From junior to mid
Eight lines that do what was asked. Write this first at every level.
class SimpleCard: def __init__(self): self.stamps = 0 def buy(self): self.stamps += 1 def redeem(self): if self.stamps >= 10: self.stamps -= 10 return True return Falsecard = SimpleCard()for _ in range(11): card.buy()assert card.redeem() and card.stamps == 1assert not card.redeem()Lines 9 to 11
Subtract ten, do not set to zero. With eleven stamps the customer keeps one. Many first versions lose it.
Why it is built this way
- Saying this is version one, it works, now I make it safe is a sentence of a good junior.
Level 3
The senior answer
The senior person writes the mid version quickly, and then breaks it. The till's network drops after the sale was counted, so it sends the sale again. The customer stands at two tills of one shop. A drink is returned. The number on the card cannot answer any of these, because it has forgotten where it came from.
The retry that gives two stamps
Senior and staff: facts, rules and one gate
1/4Facts instead of a number
The ledger keeps entries and never changes one. The balance is their sum, so it can always be explained.
owns (dies together)useshas (lives on)
From senior to staff
Each change is an entry with the receipt that caused it.
import threadingfrom dataclasses import dataclass@dataclass(frozen=True)class Entry: receipt: str kind: str stamps: int day: intclass Ledger: def __init__(self): self._entries = [] self._seen = {} self.lock = threading.Lock() def balance(self): return sum(e.stamps for e in self._entries) def find(self, receipt): return self._seen.get(receipt) def record(self, entry): self._entries.append(entry) self._seen[entry.receipt] = entryLines 5 to 10
Frozen. A fact that can be edited is not a fact, and then nobody can explain the balance to a customer.
Level 4
What staff adds without code
A staff answer is often shorter in code and longer in judgement. Here are things a staff candidate would say about the card, and each of them is a decision.
Five staff sentences
Is it needed?
A paper card costs almost nothing. The program is worth building if we want to know who comes back.
What is a mistake worth?
A wrong free drink costs little. So I prefer to give one too many over making a queue wait.
What changes at which speed?
Rules monthly, receipts never, card identity rarely. So these live in three places.
How do we switch?
Run the new rule beside the old one for a week and compare the numbers before it counts.
What do we leave out?
No expiry in the first version. The ledger has the days, so it can be added without moving data.
Staff: changing the rule safely
One question, four answers
What happens if the same card is used at two tills?
The same follow-up, four times
Interviewer
The same card is used at two tills at the same moment. What happens?
You
Junior: Both call redeem. I think both could get a drink. I would need to make sure that only one can do it at a time, with a lock.
You
Mid: The check and the subtraction must be one step. I put a lock around use in the card, so the second till gets NotEnoughStamps.
You
Senior: I lock per card and not per shop, I keep the check inside, and I test with eight threads. Across servers I use a unique receipt and a conditional update, because a lock in memory does not reach that far.
You
Staff: First I ask what it costs if it goes wrong: one drink. In one process the lock is simple, so I take it. Across shops I would accept a rare second drink, count such cases, and spend the effort elsewhere.
The interviewer says: now stamps should expire after a year. What do you do?
BreaksReset stamps to zero each January
- How
- One job sets the number.
- Limit
- A stamp from December lives one month. And the number cannot say how old each stamp is.
- Choose when
- Never, unless that is the rule people were told.
WorksStore a date next to the number
- How
- The last purchase date decides.
- Limit
- One purchase keeps all old stamps alive. Perhaps wanted, but then say it.
- Choose when
- If the rule is: one year without a visit.
StrongCompute from the ledger
- How
- Entries have days. Spend the oldest stamps first, and count only those younger than a year.
- Limit
- The balance costs a walk through the entries, or a small queue of open lots.
- Choose when
- When each stamp has its own age. The ledger makes it an addition.
Traps
How people miss their level
Signals that pull you down, and the repair
| What happens | Heard as | Do instead |
|---|---|---|
| Talks about scale, no running class | Junior or less, whatever the words | Core first, in 15 minutes |
| Patterns by name, no force | Mid at best | Force, pattern, cost |
| Clean code, waits to be asked about failure | Mid | Name two failures before the interviewer does |
| Every failure handled, nothing finished | Senior without judgement | Pick the two that cost most |
| Agrees with every suggestion | Unsure | Give the trade-off, then decide |
| Defends a mistake | Hard to work with | Say: you are right, here is the smallest change |
Grows your level
- One sentence before each step: what I do and why
- Numbers in the trace
- Naming what you leave out, and why
- Changing your mind with a reason
Lowers your level
- Silence for five minutes
- Words without code
- Building for a future nobody mentioned
- Asking permission for each line
Which level did I just show?
Practice
Climb one level in two weeks
A plan that fits any problem
- 1
Solve it at your level
45 minutes, with a timer, aloud. Keep the code.
- 2
Ask the four questions
Works? Stays correct? Fails how? Right at all? Write down the first one you did not ask.
- 3
Add one level only
Change the same code. Do not start again.
- 4
Write the test first
The retry, the race, the new rule. If it passes already, you were higher than you thought.
- 5
Say it in two sentences
What I added, and what it costs.
Useful next pages: verifying and extending a design, concurrency in LLD for the senior step, and YAGNI for the staff step.
Summary
The whole topic in one minute.
Junior makes it work and reads well. Mid protects it from wrong use and puts each rule in its place. Senior adds failure, time and concurrency, with tests that prove it. Staff questions the prompt, plans change over years and removes what is not needed.
Every level contains the previous one. Show yours by the questions you ask without help.
Titles vary between companies, and so do expectations. Ask your recruiter which level the round is for.
- Same prompt, different questions asked without help.
- Every level contains the one before.
- Junior: it works. Mid: it stays correct. Senior: it survives. Staff: it is right.
- Subtract ten, do not reset to zero.
- Give facts names: receipts make retries safe.
- Say the cost of a mistake before you fix it.
- A castle on paper does not repair a fence.
Sources
- GitLab handbook: engineering career matrix
- GitLab: backend engineer job family
- Dropbox: our updated engineering career framework (2023)
- CircleCI: redesigning engineering career paths
- Rent the Runway: the engineering ladder
- UK government: software developer role
- StaffEng: staff archetypes
- Dreyfus model of skill acquisition
- Square: Loyalty API
- Stripe: idempotent requests