Abstraction Levels

From "user clicks Buy" to the SSD in seven levels. Solve at the highest useful level first; zoom in when necessary; know that the framework is syntax over the mechanism.

Abstraction Levels

"User clicks Buy" is also a POST, a service method, a SQL transaction, a set of database pages, a filesystem write and an SSD operation. Naming the levels a problem lives on — and which one you are standing on — is how you stop mixing questions from different levels into one confused one.

Q · When a customer clicks Buy, how many different things are happening — and which of them is the one your problem is about?
Highest Useful Level First

Solve the problem at the highest level where it can be stated and checked, and go deeper only when that level cannot explain what you see. Most problems are solved at the top; the ones that are not announce themselves by a promise that holds and a symptom that persists.

Q · At which level should you try to solve this problem first — and what tells you that level was not enough?
Zoom In, Zoom Out
▶ lab

At the architecture level the store is Frontend → Backend → Database. Zoom into Backend and it is Router → Service → Repository; zoom into Database and it is Planner → Index → Pages. Every box is a system at the next zoom, and choosing the zoom is choosing which questions are visible.

Q · At which zoom level does this question have an answer — and what does each box become when you zoom into it?
Going One Layer Deeper
▶ lab

"Checkout is slow" → Backend → the database query → the B-tree → pages → the OS cache → the SSD. Each layer is a domain of its own, and the move is knowing when a layer's explanation is complete and when the next one down is required — never skipping a layer, and never going one further than the evidence sends you.

Q · When does a problem require going one layer deeper — and how do you know you have gone deep enough?
Framework Independence

Not "how do I create an Express route" but "an HTTP request arrives, a router matches it, a handler runs, a response is written". Learn the mechanism at the level below the framework and the framework becomes syntax — learnable in an afternoon, swappable in a week.

Q · What is the framework doing for you — and could you describe the mechanism without naming the framework?