Covers DDD context maps, the upstream/downstream relationship and each context-mapping pattern, with how team power, model quality and change rate drive the choice.
A context map shows the bounded contexts and how their teams and models relate. Each relationship has an upstream (whose model influences others) and a downstream. The patterns describe who adapts: partnership (teams succeed or fail together), shared kernel (a small model both own), customer-supplier (upstream plans for downstream needs), conformist (downstream simply adopts the upstream model), anti-corruption layer (downstream translates to protect its model), open host service with a published language (upstream offers a stable, versioned protocol for many consumers) and separate ways (do not integrate).
I choose by power (can I influence the upstream?), upstream model quality, how core my context is and how many consumers exist. The trade-off is translation cost versus model purity: an ACL costs code, conforming costs your model.
"A context map is the picture of how bounded contexts relate, and it is as much about teams and politics as about code. Every relationship has an upstream, whose decisions affect others, and a downstream that is affected. The patterns are really answers to 'who adapts to whom, and how much do they cooperate?'
At the cooperative end there is partnership, where two teams plan together and release together, and shared kernel, a small piece of model, say a
Moneytype and a few ids, that both own and change only by agreement. Customer-supplier is the common healthy case: the upstream team treats the downstream as a customer, includes their needs in planning, and they agree contract tests. When the upstream will not or cannot change, like a SaaS provider or a team in another division, you either conform, adopting their model as-is, which is fine if their model is good and your context isn't core, or you build an anti-corruption layer that translates their model into yours. And when an upstream has many consumers, it should offer an open host service with a published language: a versioned API or event schema, documented, that nobody gets special treatment on. Finally, separate ways: sometimes the right integration is none.For example, at [company] our [claims] context depended on a [legacy policy system] whose model had a single
POLICY_STATUScode with [27] values. Claims was our core domain, the upstream would not change, and its model was poor, so I argued for an anti-corruption layer over conforming. We translated the codes into our ownCoverStatusvalue object in one adapter, and when the legacy system was replaced [two years] later we rewrote only that adapter, [about 600 lines], and none of the claims domain. The mistake I see is teams conforming by accident: they deserialise the vendor's DTOs straight into their domain and the vendor's model spreads everywhere."
| Pattern | Who adapts | Cooperation | Use when |
|---|---|---|---|
| Partnership | Both | High, joint planning | Two teams whose goals succeed or fail together |
| Shared kernel | Both, by agreement | High | A tiny, stable model both need (ids, Money) |
| Customer-supplier | Upstream accommodates | Medium, negotiated | Same organisation, upstream willing to prioritise downstream |
| Conformist | Downstream adopts upstream model | Low | Upstream model is good enough and you cannot influence it |
| Anti-corruption layer | Downstream translates | Low | Upstream model is poor, legacy or third party, and your context is core |
| Open host service + published language | Consumers use a stable protocol | One to many | Upstream serves many consumers |
| Separate ways | Nobody | None | Integration costs more than it delivers |
| Factor | Leans towards |
|---|---|
| You can't influence the upstream, model is decent | Conformist |
| You can't influence the upstream, model is poor, your context is core | Anti-corruption layer |
| Same organisation, aligned priorities | Customer-supplier with consumer-driven contract tests |
| Many consumers of one upstream | Open host service + published language |
| Two teams constantly blocking each other on a shared model | Split the kernel, move to customer-supplier |
Mapping [nine] contexts for an [insurer] showed that [four] downstream teams were each translating the same legacy policy feed differently. We asked the policy team to publish a versioned PolicyChanged event schema (open host service and published language), and the four bespoke integrations collapsed into one, cutting integration defects from [about 10 a quarter to 2].
Checks that the candidate understands context mapping as a team and model relationship tool and can choose a pattern for a real integration.
Green flags
Red flags
[Upstream context] ──── model / data flows ────► [Downstream context]
U D
changes here affect downstream; not the other way round
The direction is about influence, not about which way HTTP calls go. A downstream service can call an upstream API, or receive its events.
+-------------+ Partnership +-------------+
| Pricing |◄─────────────►| Underwriting|
+------+------+ +------+------+
| U | U OHS/PL (PolicyChanged v2)
| Customer-supplier +-----------------+------------------+
v D v D v D v D
+-------------+ +-------------+ +-------------+ +-------------+
| Quoting | | Claims | | Billing | | Reporting |
+-------------+ +------+------+ +-------------+ +-------------+
| D ACL
v
+-------------+ U (legacy, won't change)
| Legacy PAS |
+-------------+
Writing U/D and the pattern on each line makes the politics explicit.
A shared kernel is a shared NuGet package or project. It must be tiny and change rarely, with both teams approving every change and a shared test suite. If it grows, it becomes a distributed monolith: every change needs both teams.
Downstream domain ◄── Translator ◄── Adapter ◄── Facade/Client ◄── Upstream API
(own model) (model map) (protocol) (HTTP, SOAP, files)
The ACL is the only code that knows the upstream's model.
Context maps reveal team topology issues: a downstream team that conforms to five upstreams has no autonomy; a shared kernel between teams in different reporting lines will stall. Use the map in planning conversations.
Three relationship styles in code: conformist, ACL and a published-language contract.
// Conformist: downstream uses the upstream's model directly. Cheap; fine for a supporting context.
namespace Reporting.Application;
public sealed record UpstreamPolicyDto(string PolicyNo, string Status, decimal Premium); // their shape
public sealed class PolicyReport(HttpClient http)
{
public Task<UpstreamPolicyDto[]?> GetAsync(CancellationToken ct) =>
http.GetFromJsonAsync<UpstreamPolicyDto[]>("/policies", ct);
}
// Anti-corruption layer: the core Claims context keeps its own model.
namespace Claims.Domain;
public enum CoverStatus { InForce, Lapsed, Cancelled }
public sealed record Cover(string PolicyNumber, CoverStatus Status, DateOnly From, DateOnly To);
public interface ICoverLookup // port defined by the downstream domain
{
Task<Cover?> FindAsync(string policyNumber, DateOnly onDate, CancellationToken ct);
}
namespace Claims.Infrastructure.LegacyPas;
using Claims.Domain;
internal sealed record PasPolicy(string POL_NO, string POL_STAT_CD, string EFF_DT, string EXP_DT);
internal sealed class LegacyPasCoverLookup(HttpClient http) : ICoverLookup
{
public async Task<Cover?> FindAsync(string policyNumber, DateOnly onDate, CancellationToken ct)
{
var p = await http.GetFromJsonAsync<PasPolicy>($"/pas/policy/{policyNumber}", ct);
return p is null ? null : Translate(p);
}
// The only place that knows the legacy codes.
private static Cover Translate(PasPolicy p) => new(
p.POL_NO,
p.POL_STAT_CD switch
{
"A" or "AR" or "AE" => CoverStatus.InForce,
"L" or "LG" => CoverStatus.Lapsed,
_ => CoverStatus.Cancelled
},
DateOnly.ParseExact(p.EFF_DT, "yyyyMMdd"),
DateOnly.ParseExact(p.EXP_DT, "yyyyMMdd"));
}
// Open host service + published language: a versioned contract package for all consumers.
namespace Underwriting.Contracts.V2;
public sealed record PolicyChanged(
string PolicyNumber,
string CoverStatus, // documented enum: InForce | Lapsed | Cancelled
DateOnly EffectiveFrom,
DateOnly EffectiveTo,
int SchemaVersion = 2);
Context maps are a tool for honest conversations about power. Most integration pain comes from a mismatch between the assumed relationship ("they'll accommodate us") and the real one ("we're conformist"). Naming the pattern lets you plan: budget an ACL, negotiate a customer-supplier agreement with contract tests, or push for an open host service.
Relationships also change when the organisation does. A partnership becomes customer-supplier when one team moves to another division; a supplier that was accommodating becomes effectively conformist when its priorities shift; a vendor swap turns a conformist link into an ACL. I review the map at least quarterly and after every reorganisation or vendor decision, and treat a changed relationship as a trigger to revisit the integration design.
| Pattern | When it fits | Cost | When not to |
|---|---|---|---|
| Conformist | Supporting context, good upstream model | Your model mirrors theirs | Core domain or poor upstream model |
| Anti-corruption layer | Core context, legacy or vendor upstream | Translator code and tests | Upstream model is already a good fit |
| Open host service + published language | Upstream with 3+ consumers | Versioning discipline, docs | One consumer that you also own |
| Shared kernel | Two tightly aligned teams, tiny model | Joint change process | Teams in different lines of reporting |
I measure a map's health by integration defect rates per relationship and how many cross-team changes each relationship forces per quarter.
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.
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.
Adapter converts the interface of an existing class into the interface your code expects, without changing either side. It's a translator.
For a payment SDK, I define IPaymentGateway in my domain's terms. A StripePaymentGateway adapter then turns it into SDK calls, translating types and units (decimal AUD to cents), statuses and vendor exceptions into domain results. That keeps vendor types out of the codebase, lets tests use a fake, and confines a provider change to one class.
The trade-off is an extra layer. Keep it thin: an adapter translates, and business rules don't belong in it.
How to tell it (STAR)
**S:** At [company], four teams each translated the same legacy policy feed, and Claims and Billing disagreed on cover status [hundreds] of times a month. **T:** I was asked to [reduce the integration defects]. **A:** I facilitated a context-mapping session, which showed everyone was conformist to a poor model in their own way. I proposed that the policy team publish a versioned event as an open host service, wrote the ADR with them, and kept an ACL only for our core Claims context. **R:** Integration defects fell from [about 10 a quarter to 2], and the next legacy change touched one adapter instead of four integrations.
Last updated 23 Nov 2026.