Lenguaje Ubicuo
Escrito por Darjus Kazakevic · revisado el
The business's words, used unchanged in conversation, code and tests.
A ubiquitous language is a vocabulary that domain experts and developers share word for word. Many domain bugs are translation bugs. The support lead says “the order is on hold”; the code says “status = 4”. A year later nobody knows if “on hold”, “paused” and “blocked” are one state or three.
The fix is to make the business's words the code's words: in class names, methods, events and tests. When the business sharpens a term, you rename the code. The language holds inside one bounded context only.
En esencia — Agree on one precise vocabulary with domain experts and use it unchanged everywhere: in conversation, class names, events and test titles.
Cuándo recurrir a él
Recurre a él cuando
- The domain has its own vocabulary and rules
- Domain experts are available to talk with the team
- Requirements change meaning on the way from meeting to code
Reconsidéralo cuando
- Purely technical code with no business words to borrow
- A generic subdomain where you already use a vendor's terms
- Throwaway code that will not outlive the conversation
How the language is built
- Found, not invented
- The words come from listening to experts at work. Names that developers invent, like Manager, Processor or Data, show that the modelling conversation has not happened yet.
- Precise, not only shared
- Agreement is not enough; each word needs one exact meaning. When the business uses one word for two things, the conversation splits it, and often teaches the business something.
- Visible in the code
- The words appear in identifiers: classes, methods, events and test names. An expert should recognise their own process when you read a list of test names aloud.
- Bounded
- One language per bounded context. The same word may mean something else next door, and that is fine. A company-wide dictionary brings back the confusion that contexts remove.
Keeping it alive
- Use the expert's word, even when it is ugly
- If the business says “hold”, the method is hold(), not suspend() or setStatus(4). Every private translation in a developer's head costs time in each bug report, meeting and onboarding.
- Rename the code when the language changes
- When experts sharpen a term, rename the class soon after. Once code and business use different words, the language becomes documentation, and documentation goes out of date.
- Build the words in conversation
- Find the language in workshops such as event storming or domain storytelling, or at a whiteboard with an expert. Names chosen alone in a pull request are only a naming convention.
- Treat a thing nobody can name as a signal
- If nobody can agree on a name, the model is probably missing a concept. Arguing about the name is modelling work, not wasted time.
Errores habituales
- A wiki glossary that the code has never matched
- One company-wide dictionary forced on every context
- Generic names (Manager, Helper, Info) pushing out domain terms
- Letting database column names decide the vocabulary