Video in progress
The business understands "active customer" as one thing, the code as `isEnabled` and the reports as a third. How do you introduce ubiquitous language in practice?
I write a glossary of key terms together with the business, rename the code (classes, methods, events, tables) to match it, and when a term is used with two meanings, I treat it as a sign of a missing bounded context.
📖 Answer
When the language doesn't match, bugs show up silently. For "active customer":
- marketing: someone who bought in the last 30 days;
- the risk department: someone who isn't blocked;
- the code:
user.enabled == true, which just means they can log in.
The dashboard shows "active customers: 120,000", marketing expects 40,000, and for two weeks people argue about who is right.
This is how I introduce it:
- A glossary. 20–40 key terms per context, each with a precise definition and an example. Kept in the repo, in Markdown: it lives with the code and gets reviewed.
- Names in code follow the glossary.
// vague
boolean isActive();
// precise, in business language
boolean canSignIn();
boolean hasPurchasedWithin(Duration period, Clock clock);
- One term, one meaning, inside a context. If "customer" has two meanings, there are two contexts. Name them
CrmCustomerandBillingAccount, and don't create a shared class. - Event and API names too.
UserUpdatedsays nothing;SubscriptionRenewedandCardBlockedstate business facts. - The translation issue. For business terms in Uzbek/Russian, agree on one English equivalent and put it in the glossary. "Shartnoma" shouldn't be
Contractin one place andAgreementin another.
Renaming in old code is expensive, especially DB columns and APIs. In new code use the right name; in old code use a mapping and a gradual rename. What matters is that no new debt is added.
Sign up to mark studied questions and save your progress.