Subdomains describe the problem space and bounded contexts describe the solution space in Domain-Driven Design. When a team maps subdomains onto bounded contexts, should the result usually be a clean one-to-one match, and what goes wrong when teams assume it must be?
answer
- problem space vs solution space
- subdomains = why it matters, contexts = how it's built
- 1:1 is a default, not a law
- big core subdomain may need N contexts
- forced alignment causes god-contexts or premature splits
basics
~20 sNot always. Sometimes one subdomain needs several contexts to build, and sometimes one context handles parts of several subdomains. Assuming it's always a perfect one-to-one match makes teams draw the wrong boundaries and either overload one service or split something that should stay together.
solid answer
~50 sSubdomains are a problem-space classification — describing what the business does and why each part matters strategically, independent of code. Bounded contexts are a solution-space construct — the boundary around a model, ubiquitous language, and typically a codebase or team. In the ideal case they align one-to-one, and that's a reasonable design goal. In practice a large or complex core subdomain often gets split across multiple bounded contexts as it grows (an 'order fulfillment' core subdomain might need separate contexts for inventory allocation and shipment tracking), and a single bounded context sometimes spans parts of two adjacent subdomains for pragmatic reasons — small team, low complexity, not worth separate services yet. Assuming forced one-to-one causes teams to either cram unrelated concerns into one oversized context because 'it's one subdomain,' or fragment a cohesive subdomain into needlessly many services before complexity justifies it.
go deeper
Knows subdomains and bounded contexts are different things, roughly problem versus solution space.
Can say the mapping is often but not always one-to-one and give one example of a split.
Recognizes symptoms — language fracture, god-context, premature fragmentation — in a real system and proposes a remapping.
Sets the org's practice for when to revisit subdomain-to-context mapping as products scale, balancing team topology and coordination cost.
## The two spaces Strategic design in DDD operates in two spaces. | Layer | What it yields | How | |---|---|---| | **Problem-space decomposition** | produces subdomains: partitioning everything the business needs to do into core, supporting, and generic buckets based on competitive value | arrived at by talking to domain experts and looking at the business model, not the org chart or codebase | | **Solution-space decomposition** | produces bounded contexts: boundaries within the system being built, each with its own consistent model and ubiquitous language | arrived at by looking at where language and models diverge and where team or deployment boundaries make sense | The mapping step is the bridge: for each subdomain, deciding which bounded context or contexts will implement it. ## Keeping the layers apart Why keep the two layers distinct rather than conflating them: if you let implementation convenience dictate strategic classification, you risk under-investing in a core subdomain because it happens to be awkward to isolate technically, or over-splitting a simple supporting subdomain into multiple services just because two teams happen to touch it. Keeping the layers separate also lets the business classification stay stable even as the technical architecture is refactored — a core subdomain can be re-platformed from a monolith module into several services without its strategic importance changing at all. ## What forcing a clean match costs Trade-offs of forcing one-to-one versus allowing flexible mapping: - **Forcing one-to-one gives conceptual simplicity** — one subdomain, one team, one service is easy to reason about and staff, and it's a fine default for small or medium systems. It breaks down at scale: a genuinely large core subdomain accumulates enough internal complexity and enough distinct sub-languages that cramming it into one bounded context produces a context so large its own ubiquitous language starts to fracture internally — the classic symptom of a context that needs splitting. - **Allowing multiple bounded contexts per subdomain** fixes that but costs coordination overhead — more service boundaries mean more integration contracts and more places a core business-logic change has to touch. - **Conversely, allowing multiple subdomains to share one context** saves overhead when complexity is genuinely low, but risks that context becoming a dumping ground that later needs disentangling once one of the subdomains grows. ## Three ways the mapping goes wrong Failure modes: 1. **A 'god context masquerading as the core subdomain'** occurs when a team declares 'checkout is our core subdomain, so it's one bounded context,' and years later that one service owns payment orchestration, inventory reservation, promotions, and fraud scoring, each with genuinely different models and change cadences, crammed together because nobody revisited the mapping as internal complexity grew; the symptom is a service where every deploy risks unrelated regressions and the team can't agree what 'order' even means internally anymore. 2. **Premature fragmentation is the opposite failure:** a small team splits a low-complexity supporting subdomain into several microservices before there's any team-scaling or independent-deploy reason to pay that distributed-systems tax; the symptom is constant cross-service calls and deployment coordination for something simple enough to be one module. 3. **A third failure is drawing context boundaries along org-chart lines** instead of subdomain/language boundaries — two teams each 'own' half of what should be one bounded context because of historical reporting structure, causing the same business concept to be modeled inconsistently across the split. ## Music recommendation, worked through Worked scenario: at a music-streaming company, 'music recommendation' is core. Early on it might live inside one bounded context. As the subdomain matures, it's common for that single subdomain to be realized by several bounded contexts — one for candidate generation, one for ranking and personalization, one for experiment orchestration — each with its own model and release cadence, all still serving the one core subdomain. Meanwhile something like content-licensing metadata (supporting) might share a single bounded context with adjacent catalog-management concerns, because splitting it further isn't yet justified by team size or divergent language. **The lesson:** subdomain classification tells you where to invest; bounded-context boundaries are drawn separately, based on model and language cohesion and team-scaling needs, and the two are re-evaluated on different triggers.
- What's a concrete signal that a single bounded context implementing a core subdomain has grown too large and needs to split into multiple contexts?The ubiquitous language inside that context starts fracturing — the same term is used with subtly different meanings by different parts of the team, or a term needs qualifying adjectives to stay unambiguous; that internal language drift is the classic sign the context actually covers more than one coherent model.
- Should a generic subdomain ever get its own dedicated bounded context, or does it just live inside whichever context needs it?It can still get its own thin bounded context — often a lightweight adapter around the vendor API or library — mainly to isolate the integration and keep the vendor's vocabulary from leaking into the core or supporting contexts' ubiquitous language, even though little custom modeling happens there.
A subdomain is like a department's mission statement (e.g., 'win customers through personalization') while a bounded context is like the actual org chart of teams and systems built to deliver on it — sometimes one mission needs three teams to execute, sometimes one team covers two related missions, and confusing the mission statement with the org chart leads to bad restructuring.
saying these in an interview costs you the question
- assumes every subdomain must equal exactly one service
- conflates bounded-context boundaries with org-chart boundaries without checking model cohesion
- can't explain the difference between problem space and solution space
- proposes splitting a small, low-complexity subdomain into many services with no stated driver
- lets one bounded context silently absorb unrelated subdomains until it becomes a monolith in disguise