SteelReed

Search

Search posts, questions…

8. Senior Skills

Problem solving like a senior: definitions, causal diagrams, 5 Whys and a checklist

A problem is the gap between a stakeholder's perceived and expected reality; the elevator case study with a causal diagram, a seven-step process, a critical-thinking checklist, 5 Whys, Seven-So-What, 80/20, and an order, duplication, relationship, direction, consistency checklist for distributed systems.

18 Nov 20268 min readSenior

–

1. The problem

Your manager says "the revenue report is too slow, see if Elasticsearch helps". Measured: the monthly report takes 45 seconds, and accounting accepts data up to 1 hour old. A summary table refreshed hourly brings it under 5 seconds with no new system.

2. Key idea

A senior takes a situation ("customers say it's slow") and works out what the real problem is and whose it is. Perception is not objective reality: an empty spinner turning for 3 seconds feels "slow" even when the API takes 800 ms.

The elevator example: a building with two elevators, overloaded every morning. A causal diagram breaks "staff are annoyed" into waiting long AND nothing to do while waiting; the leaves are solutions whose costs you compare.

Direction Elevator example Cost In software
Capacity add an elevator very high, months to years scale out, bigger machines
Demand stagger check-in from 8:00–9:30 nearly zero rate limits, queues to smooth load, staggered batches
Perception mirrors, a TV in the lobby low skeleton UI, 202 Accepted with job status

The usual order: smooth demand first, change perception for the rest, add capacity only once you've measured and the other two aren't enough.

2.1 Which tool when?

Tool Use when Don't use when
Problem statement any request that starts with a technology name an incident is burning: roll back first, ask later
Causal diagram a symptom has several AND/OR causes a one-line bug that's already clear
5 Whys finding the root after an incident stopping at "dev A forgot to check"
80/20 (Pareto) many branches; pick the 20% causing 80% of the wait branches are roughly equal
Seven-So-What ("so what?") uncovering bad side effects of a solution before the problem is defined

3. In practice

Write the problem statement before discussing technology, using the checklist: goal, scope, constraints, assumptions, stakeholders, the real question.

Stakeholders: accountants (daily), the CFO (month end).
Reality:      the monthly report takes 45 s during the last 3 days of the month.
Expectation:  under 5 s; data up to 1 hour old is acceptable (to confirm).
Scope:        the revenue report only.
Constraints:  no new systems this quarter; data lives in PostgreSQL.
Assumptions:  the query is slow (not yet measured), not the Excel export.
Real question: "use Elasticsearch" is an option; the goal is "monthly report under 5 s".
Three traps and five questions for distributed designs

Three common traps: jumping to a solution ("use Kafka"), solving the wrong problem (tuning a query from 400 to 120 ms while users wait on 6 MB of JavaScript), not widening the problem (a Java-only team turns everything into "another Java service").

Item Question Example bug
Order Is order guaranteed, and within what scope? OrderCancelled arrives before OrderCreated on another partition
Duplication What if it runs twice? A retry creates two payments; Kafka at-least-once processes a duplicate
Relationship Who owns the data; what if one side is deleted? Two services write the same table
Direction Who calls whom; are there cycles? A calls B, B calls back A, a timeout loop
Consistency Sync or async; how far behind? Reading a replica right after writing, not seeing your own change

Also check three things in your head: misconceptions (believing @Transactional also covers sending to Kafka), assumptions ("clients never retry") and unstated expectations ("realtime" sometimes means "before 9 a.m."). Paste the five questions into your design doc or PR template.

"Can't reproduce" bugs often hide in hidden inputs (config, the JVM timezone, caches); incidents that spread often hide in hidden outputs (events, emails, side effects).

4. Working with AI

AI proposes solutions very fast; make it define the problem first.

Hand to AI: a causal diagram from an incident description, a list of unchecked assumptions, Seven-So-What.

Check in AI output:

  • There is a problem statement with stakeholders and numbers before any technology name.
  • There is a demand or perception option, not just capacity.
  • Every assumption has a way to check it (a measurement, query, log).
  • The 5 Whys ends at something fixable at system level (a test, constraint, checklist, alert).
Here is the situation. Don't propose technology yet.
1. Write a problem statement: stakeholders, measured reality, expected numbers, scope, constraints.
2. List unchecked assumptions and how to check each one.
3. Propose one option each for capacity, demand and perception; compare costs.

5. Exercises

Exercise 1: 5 Whys for duplicate emails

A reminder email job sent the same email to customers three times in one night. Run 5 Whys to a root cause fixable at the system level.

Solution to Exercise 1
  • Why three times? All three pods ran the job.
  • Why? @Scheduled runs on every instance; last week the HPA scaled from 1 to 3 pods.
  • Why did nobody notice? The test environment has only 1 pod.
  • Why doesn't the job guard against duplicates? The design assumed "only one instance".

Root: the instance-count assumption was never written down or checked. Fix: a distributed lock for the job (ShedLock) and a sent marker on reminder_id with a unique constraint, so any repeated run is harmless. Add "what if it runs on N instances?" to the review checklist (the Duplication item).

Exercise 2: Pick a direction for "the app is slow at 9 a.m."

Users say "the app is slow" around 8:45–9:30 every morning. The AI suggests doubling the pod count. Give at least one option each for capacity, demand and perception, and say when adding pods is right.

Solution to Exercise 2
  • Capacity: an index for the heaviest query, more pods or a bigger connection pool.
  • Demand: move sync or batch jobs running at 9:00 to another time; add jitter to cache TTLs so they don't expire together; rate limit clients that burst.
  • Perception: skeleton UI, load the important part first, partial results.

Measure first: if pod CPU is at 90% and queries are fast, more pods is right. If the DB is the bottleneck, more pods only make the DB worse; if a 9:00 batch eats the load, smoothing demand is far cheaper.

Summary

  • A problem is the gap between perception and expectation for a specific person.
  • Three ways to close it: change reality, change perception, adjust expectations; capacity is usually the most expensive.
  • A problem statement has stakeholders and numbers, before any technology name.
  • 5 Whys doesn't stop at "human error".
  • Distributed review: order, duplication, relationship, direction, consistency.

Read more: Part 2: Analysing trade-offs.

Practice interview questions on this topic

All System Design questions →All Behavioral questions →

Loading comments…