Part 5 of 9 · 2 min read
Every choice is a trade-off
Why "it depends" is the honest answer, and how to say what it depends on.
Think of choosing how to get to work. A taxi is fast and costs more. A bus is cheap and slower. Neither is "the best". The best one depends on how late the person is, and how much money is in their pocket.
Design choices work the same way. Each option gains something and loses something.
Trade-off
A trade-off is a choice where improving one quality makes another quality worse. A good designer names both sides, then picks the side that matters more for this system.
Example: keeping orders only in a program's memory is very fast, but every order is lost if the program restarts. Saving each order to disk is slower, but nothing is lost.
A worked example with small numbers. These numbers are made up to show the idea.
- The bakery shop gets 2,000 orders a day.
- Saving to disk adds 10 milliseconds (a millisecond is a thousandth of a second) to each order. That is 20 seconds of extra waiting in total across a whole day, spread over thousands of customers.
- One lost order costs the bakery a customer and about 15 dollars.
- Ten milliseconds is too small for anyone to notice. A lost order is something every customer notices.
The choice is easy here: save to disk. The same choice could go the other way for a game that shows a live score every 50 milliseconds. A lost score is replaced by the next one a moment later, so speed matters more than saving.
Common mistake
"It depends" is not an answer by itself. A complete answer says what it depends on, and then picks one: "It depends on whether a lost order is worse than a slower order. Here, it is worse, so I would save each order."
Check yourself:
- Name one thing gained and one thing lost by using a taxi instead of a bus.
- For a live game score, why is losing one update acceptable?