Domain language
The vocabulary and concepts experts in the field use.
Using users' own terms makes a product feel built for them, and getting them wrong costs trust quickly. A shared vocabulary also improves code, since models and names match the domain. This idea is central to domain-driven design.
Why it matters for a product engineer
People notice quickly when a product uses the wrong words for their work, and they trust it less. Inside the team, one shared vocabulary means the code, the interface and conversations with experts use the same names. Eric Evans calls this a ubiquitous language. Engineers own the half of it that lives in the code.
How to do it
- Collect the words experts use, from interviews, documents and support tickets, with a short definition for each.
- Use those words in the interface, in the code and in conversation. If a class has a different name from the thing on screen, one of the two is wrong.
- Listen for words that mean different things to different groups.
- Draw a boundary where the meaning changes. In domain-driven design this is a bounded context: inside it, each word has one meaning, and you map between contexts at the edges.
- Let experts object to awkward terms, and change the model as your understanding grows.
Common mistakes
- New names for things users already have names for.
- Engine words in the interface, such as the name of a table or a service.
- One model for the whole company, so a word must mean everything to everyone.
- Renaming in the interface but not in the code, so the two drift apart.
Example
Martin Fowler worked with an electricity utility where “meter” meant different things to different parts of the organisation. People could smooth this over in conversation, but software could not. The answer is not one perfect definition. Each part of the system keeps one meaning, and the parts map between them.
One word, three meanings: "meter" at an electricity utility
| What it meant | |
|---|---|
| A link | The connection between the grid and a location |
| Another link | The connection between the grid and a customer |
| A device | The physical meter, which can be replaced if it fails |
A person tells these apart from context. A database cannot, so each meaning needs its own model and its own name.
ReportedMartin Fowler, Bounded context
Sources: Ubiquitous language (Martin Fowler) ↗ · Bounded context (Martin Fowler) ↗
Resources
2- articleStart here
Ubiquitous language ↗
Martin Fowler · 2 minWhy developers and domain experts should share one precise vocabulary, and carry it into the code.
- articleGo deeper
Bounded context ↗
Martin Fowler · 3 minThe same word can mean different things in different parts of a business; this is how to draw those lines.