Ubiquitous Language in the Schema Layer

Ask an airline's ground crew where a suitcase is and you will hear "offloaded" or "on the belt". Open the baggage system's code and you may find status: 4. Domain-driven design calls this gap a tax on every conversation. LVD offers a structural reason for closing it at one particular spot: the Schema layer.

Why the lowest layer carries the vocabulary

Ubiquitous language is the DDD habit of using one shared vocabulary, whether you are talking to a domain expert, drafting a design or naming a variable. The difficulty is keeping it that way for years, through staff turnover and deadlines. The book argues that Layer 1 is the natural enforcement point, and the reason is mechanical. Everything above it imports its types.

That dependency does the work. If the Schema layer uses the exact terms of the business, those terms flow upward on their own into tools, routes and agent descriptions. Nobody has to remember to be consistent further up, because nothing else is available to import. The flip side, which is my own observation, is that a wrong word at Layer 1 spreads just as efficiently as a right one. Renaming it later is a wide change. That argues for getting the words right early, before the upper layers pile up around them, and for reviewing that vocabulary more carefully than most code.

Enums are where language drifts first

Enumerated types, in the book's view, are frequently the first place where technical and business vocabulary part ways. Someone needs a quick state field, invents a number or a cryptic label and moves on. LVD's rule that enumerations live in the Schema layer pushes against this, because it makes the developer stop and consult a domain expert while writing the definition.

Here is how the baggage example might look when the ground crew has reviewed it:

// schema/baggage.ts
export const BagStage = [
  "tagged",     // label printed at check-in
  "screened",   // passed the security scan
  "loaded",     // in the hold of the aircraft
  "offloaded",  // removed before departure
  "on_belt",    // on the arrivals carousel
  "claimed",    // collected by the passenger
] as const;
export type BagStage = (typeof BagStage)[number];

The comments are doing a job. The book describes comments like these as an executable specification that developers and domain experts can read together. A baggage supervisor does not need to follow any logic to notice that "offloaded" is missing a case, or that nobody on the floor says "screened" when they mean "cleared".

A review habit worth adopting

This part is my own suggestion, not the book's. Treat changes to those Schema files as a conversation with the business, not as a pull request that only engineers read. Send the file, or a rendered list of its values and comments, to the person who owns the process. If they do not recognise a word, rename the value; do not add a footnote.

A cheap audit gets you started. List every enumeration in the codebase and mark each value as either something the business would say or something only engineers say. The second group is a list of renaming candidates, and any enumeration defined outside the Schema layer is a candidate for moving into it.

A second habit is to watch for the same word meaning different things. In the baggage example, "cleared" might mean passed security to the screening team and released by customs to the arrivals team. When one word has two honest meanings, you are probably looking at two bounded contexts, and each context's Schema layer should say its own meaning plainly instead of forcing a compromise. That is the subject of bounded contexts with LVD.

The takeaway

The principle is simple: put the business's words at the one layer everything else imports, and make the people who use those words check them. The book continues the argument into validation rules, expressing business invariants in the same layer so that invalid states are rejected structurally, before any tool logic runs. For the layer itself, see the Schema layer as the most stable code, and for how DDD concepts line up across the whole stack, mapping DDD to LVD layers.

What the book covers

  • Domain invariants written as schema refinements, so invalid states fail validation before reaching the Tools layer
  • Why structural enforcement gives defence in depth independent of application logic
  • A worked e-commerce vocabulary covering order status, fulfilment priority and return reasons
  • How enumeration comments double as a specification that developers and domain experts review together