Worked Example: A Schema and Utils Pair for Bike-Share Rentals
One small feature carried through the two bottom layers: a rental schema with a cross-field rule, and pure fare utilities that import its types.
Ask a team what happens when the parking tariff changes and you will hear a list: the request handler, a database query, the receipt screen, a test fixture or two. Layer the code properly and the honest answer shrinks to one file. The interesting thing about the bottom of LVD is not only what its layers contain but what they do to the shape of a change.
Picture a tool that ends a parking session. It reads the session, works out the charge and saves the result. Each step lives in a different layer:
export const endSession = async (sessionId: string, now: Date) => {
const session = await sessions.get(sessionId); // L3 Resources
const charge = parkingCharge(session, now); // L2 Utils
return sessions.save({ ...session, endedAt: now.toISOString(), charge });
}; // the Session type itself comes from L1 Schema
Now run three changes through it. A new tariff? That is a calculation, so it changes in Utils and the tool stays as it is. A new field on every session, such as the bay number? That is a change to the shape of the data, so it starts in Schema. A move from one database to another? Only Resources is rewritten, and again the tool is untouched.
The tool is also easy to test as a result. Stub the repository, pass literal data and a fixed time, and the interesting logic is a handful of calls whose results you can predict by hand.
That is the book's argument for the arrangement. Each kind of change has one obvious address, and the tool in the middle only composes. It neither computes tariffs nor knows what a table is.
The same arrows that localise change also explain why the bottom layers need care. Every higher layer builds on Schema, and many lean on Utils, so a mistake there reaches the whole system. The book's summary is brisk: foundation layers must be highly stable, they warrant thorough testing, and their functions should stay pure and simple.
Their dependency budgets are tiny for the same reason. Schema, at a volatility of 0.3, depends on nothing. Utils, at 0.4, depends only on Schema. With so little beneath them, little can disturb them from below, and the only reason they change is that the business meaning of the data or the rules of a calculation really changed.
This also explains the volatility ordering that runs through LVD. Tariffs, screens and workflows change often, so they sit high, where a change disturbs few other things. Definitions and pure rules change rarely, so they sit low, where everything can rely on them.
The book's second example is on the other side of the stack. A UI component displays a price by calling a formatting function from Utils. The server has already done the calculation; the component only formats the result. The same Utils module serves both the tool and the screen, but each caller uses a different half.
In our parking example, a receipt screen would format a duration or an amount the API handed it. It would not recompute the charge. Reuse of formatting is cheap and safe. Recalculation in two places is where figures start to disagree.
When the next change request arrives, ask which layer has a reason to change before you open an editor. If the honest answer is two or three layers, either the change is bigger than it looks or something sits in the wrong place. Asking early turns the layer diagram into a working tool rather than a poster.
Dependency direction is a map of who has to change. Put types in Schema, calculations in Utils and everything that touches the outside world in Resources, and most changes land in a single layer. If you want to see the two bottom layers working alone first, start with a worked example, or look ahead to how Resources keeps outside systems at arm's length.