# Discovering Domain Knowledge
> **In one sentence:** what ships to production is the team's *understanding* of the business,
> so the most important engineering skill is learning that business accurately.

Chapter 1 looked across the business. This chapter looks inside a single subdomain: how its rules
actually work, and how engineers can learn them without distorting them.

## Business problems

Here a "problem" isn't a puzzle you solve once. It's an ongoing need: streamlining a workflow,
cutting manual work, managing resources, supporting decisions. Problems exist at the level of the
whole company and inside each subdomain.

## Why knowledge gets lost

On a typical project, business knowledge passes through a chain of hand-offs:

**expert → analyst → analysis model → requirements → design doc → code**

Every hand-off is a translation, and every translation loses detail, much like whispering a message
down a line of people. The documents in the middle also go out of date quickly. You end up with
the wrong solution, or a good solution to the wrong problem.

## Ubiquitous language

DDD's answer is simple: **stop translating and share one language.** Experts, engineers, product
people, designers and testers all describe the business with the same words, and the experts must
feel comfortable with those words because the language reflects *their* way of thinking.

**What makes a good ubiquitous language**

- **Business words only.** Say "an order can ship once every item is reserved", not "an order row
  needs matching rows in the reservations table". Experts can check the first sentence. They can't
  check the second.
- **One meaning per term.** If "account" sometimes means a customer and sometimes a ledger entry,
  split it into two terms.
- **No hidden synonyms.** Words that look interchangeable ("member", "guest", "user") often mean
  different roles with different behavior. Keep them separate and precise.

## Models

A **model** is a simplified picture built for a specific purpose. It deliberately leaves things
out. Maps are the classic example: a metro map, a hiking map and a flight chart all describe the
same planet, but each shows only what its user needs.

- A good model has *just enough* detail for its job, nothing more and nothing missing.
- Abstraction isn't about being vague. It's about being exact at the level that matters.
- When you build a ubiquitous language, you're really building a model of how the experts think:
  the entities, their behavior, cause and effect, and the rules that must always hold.
- It doesn't have to cover the whole business, only what the system needs.

The more complex the domain, the more a small misunderstanding costs. The only reliable way to
check your understanding is to talk it through with the experts in their own language.

## Keeping the language alive

- **Use it everywhere**: in conversations, tickets, docs, tests and code (class and method names).
- **Expect it to change.** As the team learns, the language will sharpen. Update it, and update the
  code to match.
- **Supporting tools:**
  - A shared **glossary** (wiki) that anyone can edit. It's great for nouns.
  - **Behavior-style tests** (for example Gherkin `Given / When / Then`). They capture rules and
    flows, which glossaries handle badly, and experts can read them, though don't expect experts
    to write them.
  - **Static analysis** can flag code that drifts from agreed terms.
- Tools only help. People actually *speaking* the language is what counts.

## Common challenges

- **Tacit knowledge.** The important rules often live only in experts' heads. Ask lots of questions.
- **Co-discovery.** Your questions often expose gaps and unhandled edge cases the experts hadn't
  thought about, especially in core subdomains. You end up shaping the model *with* them.
- **Legacy vocabulary.** Existing teams may talk in table names and system jargon. Change it
  patiently, starting where you have control: your code and docs.
- **Non-English organizations.** Using English nouns for entities at least keeps code and
  conversation aligned.

## Check yourself

1. What is a ubiquitous language for?
2. Who contributes to it?
3. Where should it be used?
4. Two departments use "policy" for unrelated things. What do you do? (Chapter 3 gives the full answer.)

<details><summary>Answers</summary>

1. To give business and technical people one shared, precise vocabulary.
2. Everyone on the project.
3. Everywhere: in talk, docs and code.
4. Each meaning gets its own explicit context, which is a bounded context.

</details>
