Part 3 of 9 · 1 min read
Design is not the same as code
Why the big choices come first, and why they are costly to change later.
Think of building a house. The plan says where the walls, the doors and the water pipes go. Later, a worker decides which screws to use for one cupboard. A wrong screw is easy to swap. A wrong wall is very costly to move once the roof is on.
Software has the same two levels. A design choice is hard to change later and affects many parts. A code choice is local and easy to change.
| Question | Level | Easy to change later? |
|---|---|---|
| Should orders live in one shared data store (a part that keeps information safe; section 3 explains it) or on each server? | Design | No |
| Should the shop send emails right away or through a waiting line? | Design | No |
| What should this one function be called? | Code | Yes |
| Should this loop use a list or a set? | Code | Yes |
A design also answers a question that code never answers: "Why this way, and not another?" Good designers write down the reason with each choice. The shape of a system tells a reader how it works. Only the reason tells the reader why it works that way.
Read it as
When a page in this path says "design", read it as "the choices that are costly to undo". When it says "code", read it as "the details that are cheap to fix".
Check yourself:
- Is "keep orders in a data store or in a plain file" a design choice or a code choice? Why?
- Why is the reason for a choice worth writing down?