CSE Roadmap

Core tier · about 3 hours · 9 parts

Part 6 of 9 · 2 min read

Least worst, not best

Why no design is best, and how to compare designs with a trade-off table.

Think of choosing a phone. A phone with the best camera, the longest battery, the lowest price and the lightest weight does not exist. Every phone gives up something.

Designs are the same. Pursuing every quality at once makes the design complicated, and complexity itself damages other qualities. The goal is a design with the least worst set of trade-offs for this system.

Least worst design

A least worst design is the design whose weaknesses hurt the least, given what matters most for this system. It admits that every design has weaknesses, and chooses which ones to live with.

Example: a design that is slightly slower but never loses an order may be least worst for a shop, even though a faster design exists.

Two sayings from the book are worth keeping.

  1. "Everything is a trade-off." If a designer believes they found a choice with no downside, they have probably not found the downside yet.
  2. "Why is more important than how." A drawing shows how a system is built. Only the written reason shows why. Years later, the reason is what the next team needs, to know whether a choice still makes sense.

A trade-off table makes the comparison visible. A worked example. A site sends an order event to three other services: billing, tracking and analytics. There are two ways.

Quality Option A: one shared topic (publish to all) Option B: one queue per service
Adding a fourth service Easy: the new service listens to the topic Harder: a new queue and a change to the sender
Control per service Lower: all get the same messages Higher: each queue can differ
Complexity of the sender Low: one connection Higher: three connections
Security separation Weaker: everyone can read the topic Stronger: each queue has its own access

Neither wins on every row. If the team expects to add services often, option A fits. If the services handle sensitive data and must be kept apart, option B fits. The answer depends on the driving qualities, which is why "it depends" is correct, followed by "on what".

Interview angle

Answer in your head first, then open it.

How do you compare two designs that each have strengths?

State both sides of every major choice. A sentence such as "I choose A, because extensibility matters here, and I accept weaker access control, which I would fix by adding rules at the topic" shows judgement and honesty.

Check yourself:

  • In the table, which option suits a company that adds a new service every month?
  • Why is "the reason" worth writing down next to a drawing?