Covers what a bounded context is, heuristics for finding context boundaries, polysemous terms like Customer, and how contexts map to modules, microservices, databases and teams.
A bounded context is an explicit boundary around a model tailored to one part of the business, inside which one ubiquitous language is consistent and which can evolve independently of others. Outside it, the same word can mean something else: Customer in Sales is a lead with a credit check, in Billing it is a payer with invoices, in Support it is a contact with tickets. One shared Customer for all three gives a bloated, coupled model.
You discover boundaries with event storming (where experts argue over a term, or a pivotal event like "Order Placed"), a glossary, workflow handoffs and who owns which rules. Each context owns its data; others keep only the identity (CustomerId) and learn about changes through published events or an API, never by reading its tables. A context maps to a module or to one or more services, owned by one team (Conway's law). The trade-off: some duplicated data in exchange for models that change independently.
"A bounded context is the boundary inside which a model means one thing. Inside the Billing context, Customer means the party who pays: they have a billing address, payment terms and invoices. Inside Sales, Customer is someone we're trying to sell to: lead source, credit check, account manager. Inside Support, it's a contact with tickets and an SLA. Those are three different models that happen to share a name and an id. If you force them into one Customer class, every team's change risks breaking the others, and the class collects 80 nullable columns.
To find contexts I listen for where the language changes. In an event storming session you see it when experts argue about what a word means: that's usually a boundary. Other signals are different experts owning the rules, a handoff in the workflow such as 'once the order is placed, fulfilment takes over', and data that changes at very different rates or for different reasons. I also look at the subdomains: ideally each bounded context covers one subdomain, though in legacy systems one big context often covers several, which is exactly the problem.
Once I have boundaries, each context owns its model and its data. Other contexts reference its things by id and learn about changes through events or a published API, never by reading its tables. In a .NET modular monolith that's one module per context, with its own
DbContextand schema; in a distributed system it's one or more services per context, but never a service spanning two contexts. And I align them with teams, because of Conway's law: a context owned by two teams quickly becomes two contexts badly glued together. The mistake I see is drawing boundaries by technical layer or by entity, a 'Customer service', instead of by language and capability."
| Context | "Customer" means | Key data | Owner |
|---|---|---|---|
| Sales | Prospect or account we sell to | Lead source, credit check, account manager | Sales team |
| Billing | The party who pays | Billing address, payment terms, invoices, ABN | Finance team |
| Support | A person who raises tickets | Contact details, SLA tier, ticket history | Support team |
| Signal | Example |
|---|---|
| Language changes | "Policy" in underwriting (a quote being priced) vs in claims (cover in force on a date) |
| Different experts | Pricing actuaries vs claims assessors |
| Workflow handoff | Order placed → fulfilment → delivery |
| Different change rates | Product catalogue edited daily vs tax rules edited yearly |
| Different consistency needs | Payments must be strict; recommendations can be stale |
| Option | When it fits | Watch out for |
|---|---|---|
| Module per context in a modular monolith | Small to medium teams, early in the product | Enforce boundaries with architecture tests and separate schemas |
| Service per context | Independent scaling, deployment or team autonomy needed | Distributed systems tax |
| Several services in one context | One context with very different runtime needs (API vs batch) | They share a model, so one team owns all of them |
At [a retailer], one shared Customer table with [~90 columns] was edited by four teams, and every schema change needed a cross-team release. Splitting into Sales, Billing and Support contexts, each with its own customer projection keyed by CustomerId and synchronised by events, reduced coordinated releases from [every sprint] to [roughly once a quarter].
Checks that the candidate can define bounded contexts, find them in a real business, and connect them to modules, data ownership and teams.
Green flags
Red flags
A model is a simplification built for a purpose. Because purposes differ, one model cannot serve every part of a business well. The boundary makes explicit where a model applies, so a word can be precise inside it.
+---------- Sales ----------+ +--------- Billing ---------+ +-------- Support --------+
| Customer | | Customer (Payer) | | Customer (Contact) |
| - LeadSource | | - BillingAddress | | - Email, Phone |
| - CreditStatus | | - PaymentTerms | | - SlaTier |
| - AccountManager | | - Invoices[] | | - Tickets[] |
+-------------+-------------+ +-------------+-------------+ +------------+------------+
│ CustomerId + CustomerRegistered event │
+-----------------------------+-----------------------------------+
The shared thing is the identity (CustomerId), not the model.
| Subdomain | Bounded context | |
|---|---|---|
| Space | Problem (how the business is organised) | Solution (how the software is organised) |
| Found by | Talking about the business | Designing models and boundaries |
| Ideal | Aligned 1:1 with a bounded context | Covers one subdomain |
Each context is the single writer of its data. Others get data by:
CustomerRegistered, BillingAddressChanged) and keeping a local copy of what they need.src/
Modules/
Sales/ Sales.Domain, Sales.Application, Sales.Infrastructure (SalesDbContext, schema 'sales')
Billing/ Billing.* (BillingDbContext, schema 'billing')
Support/ Support.* (SupportDbContext, schema 'support')
Host/ ASP.NET Core composition root
Each module exposes a small public contract project (commands, queries, integration events); everything else is internal. Architecture tests stop Billing referencing Sales.Infrastructure.
Boundaries are discovered, not decided once. Start with fewer, larger contexts while learning; split when the language diverges or two teams keep colliding. Merging is cheap inside a monolith and expensive across services, which is one reason to start with modules.
Customer, Product) and list which teams use which columns. Group them.git log --name-only over six months and see which folders change together.DbContext with HasDefaultSchema("billing") for one module and an architecture test enforcing that no other module references it.Two contexts, two Customer models, linked only by id and an integration event.
// Sales context: its own model of Customer.
namespace Sales.Domain;
public readonly record struct CustomerId(Guid Value);
public sealed class Customer
{
private Customer() { }
public Customer(CustomerId id, string name, string leadSource) => (Id, Name, LeadSource) = (id, name, leadSource);
public CustomerId Id { get; private set; }
public string Name { get; private set; } = "";
public string LeadSource { get; private set; } = "";
public bool CreditApproved { get; private set; }
public void ApproveCredit() => CreditApproved = true;
}
// Billing context: a different Customer (the payer), with only what billing needs.
namespace Billing.Domain;
public sealed class Payer
{
private Payer() { }
public Payer(Guid customerId, string legalName, string? abn) => (CustomerId, LegalName, Abn) = (customerId, legalName, abn);
public Guid CustomerId { get; private set; } // shared identity, not a shared model
public string LegalName { get; private set; } = "";
public string? Abn { get; private set; }
public int PaymentTermsDays { get; private set; } = 14;
}
// Published language: the integration event Sales publishes and Billing consumes.
namespace Sales.Contracts;
public sealed record CustomerRegisteredV1(Guid CustomerId, string LegalName, string? Abn, DateTimeOffset OccurredAt);
// Billing handler: translates the event into Billing's own model.
namespace Billing.Application;
public sealed class CustomerRegisteredHandler(BillingDbContext db)
{
public async Task HandleAsync(Sales.Contracts.CustomerRegisteredV1 e, CancellationToken ct)
{
if (await db.Payers.AnyAsync(p => p.CustomerId == e.CustomerId, ct)) return; // idempotent
db.Payers.Add(new Billing.Domain.Payer(e.CustomerId, e.LegalName, e.Abn));
await db.SaveChangesAsync(ct);
}
}
Customer model. Why it is wrong: it serves no context well, grows dozens of nullable fields, couples every team's releases, and blurs who owns which data, so two teams overwrite each other's fields and integrity rules conflict. Instead: one model per bounded context, linked by id, with one owner per piece of data.Bounded contexts are the most valuable idea in DDD because they decide team structure, data ownership and, later, deployment boundaries. Getting them wrong across services is expensive; getting them wrong inside a monolith is a refactor. That asymmetry is why I discover boundaries in a modular monolith first.
The cost of a wrong boundary is architectural debt that spreads across teams: a request that needs five synchronous calls, a 'simple' change that needs three teams to release together, and shared tables nobody dares change. That debt shows up in DORA metrics (lead time and change failure rate) before anyone names it, so I watch those alongside the application map.
| Mapping | When it fits | Cost | When not to |
|---|---|---|---|
| Context = module | Most new systems, one to four teams | Discipline, architecture tests | Very different scaling or compliance needs |
| Context = service | Independent teams, scaling, release cadence | Network, eventual consistency, ops | Boundaries still moving |
| Shared kernel between contexts | Two closely cooperating teams, tiny stable model | Coordination on every change | Teams in different reporting lines |
I measure boundary quality by how often a change needs coordinated releases across contexts and how many cross-context calls a single request makes (Application Insights application map).
A modular monolith is one deployable split into modules aligned to business capabilities — Orders, Billing, Catalogue — each with hard boundaries.
DbContext, no cross-module joins or foreign keys.internal.internal types, architecture tests, even per-schema database permissions.You get microservice-style boundaries with monolith-style operations: one pipeline, in-process calls, easy refactoring. The trade-off: one runtime, one release and one scaling unit, and it only works if the boundaries are enforced — otherwise it decays into a big ball of mud.
An integration event is a public API owned by the publisher. Within a version I only make backward-compatible changes: add optional (nullable or defaulted) fields. I never add a required field mid-version (messages already in queues won't have it), and never rename, remove or retype. Consumers are tolerant readers: they ignore unknown fields and default missing optional ones. A breaking change becomes a new event type (orders.order-placed.v2), published alongside v1 until consumers move, then deprecated with a date.
I wrap events in a CloudEvents envelope (id, source, type, time, dataschema). Each publisher ships its own contracts package or JSON Schema; one shared events library for every service forces lockstep upgrades.
The trade-off: discipline and some duplication in exchange for independent deployments.
Domain-Driven Design is an approach where the software model mirrors the business domain and is built in close collaboration with domain experts. It has two halves. Strategic design splits a large problem into subdomains (core, supporting, generic) and bounded contexts, each with its own model, and maps how they relate. Tactical design gives building blocks for the model inside one context: entities, value objects, aggregates, domain events, repositories and domain services. The glue is the ubiquitous language: the same words in meetings, code, tests and the UI.
DDD is worth it for a complex, changing core domain that gives the business its edge. For CRUD screens or generic problems (auth, invoicing PDFs) the tactical patterns are ceremony: use strategic thinking everywhere, tactical patterns only where the rules are hard.
How to tell it (STAR)
**S:** At [company], four teams shared one [90-column] Customer table, and a Support change once bounced [2,000] invoices. **T:** I was asked to [propose how to stop teams breaking each other]. **A:** I ran a workshop where each team defined 'customer', showed the column usage I had mapped from Query Store, and proposed three bounded contexts with their own models linked by `CustomerId` and events. I wrote the ADR, got buy-in from the [team leads], and led the migration of Billing first. **R:** Coordinated releases dropped from [every sprint] to [about once a quarter], with no repeat of the invoice incident.
Last updated 23 Nov 2026.