Bounded Context and Context Mapping
A Bounded Context sets the boundary; a Context Map describes what happens on it. Eight named relationships between contexts, from close collaboration to deliberate separation.
In this chapter
Strategic design in DDD has two sides. A Bounded Context defines the boundary of one model: what is inside, what is outside, and where one Ubiquitous Language ends and another begins. The definition is covered in What Is Domain-Driven Design, the tactical consequences in DDD Building Blocks. What it does not address is what happens on that boundary when two contexts need to work together.
Context Mapping answers that. Evans described it in 2003 in Domain-Driven Design: Tackling Complexity in the Heart of Software, in chapter 14 (Maintaining Model Integrity), as visual and textual documentation of all Bounded Contexts in a system and the relationships between them [1]. Vaughn Vernon extended the discipline with practical implementation patterns in Implementing Domain-Driven Design (2013) [2]. In practice, a Context Map typically comes out of Event Storming, the subject of the next chapter. This chapter covers the eight named relationships between BCs and their trade-offs. The Symfony 8 examples build on CQRS with Symfony Messenger, REST APIs, and HTTP clients.
03.01 What a Context Map is and why to draw one#
Eric Evans defines the Context Map as an overview of all models on a project. Each one gets a name and its own Bounded Context. For every point of contact between models, the map describes the explicit translation, everything shared, the isolation mechanisms, and how much influence one side has over the other [1]. Evans adds an order of work: first map the terrain as it actually is, and deal with transformations only afterward. The map therefore describes what is, not what should be. It has nothing to do with a UML class diagram; it is an organizational and political map: who talks to whom, in what language, and who decides when the language has to change.
A Context Map has two parts:
- The visual part – a diagram with boxes (Bounded Contexts) and arrows (relationships) carrying stereotypes (
<<ACL>>,<<OHS>>,U/Dfor upstream/downstream). - The textual part – a short document describing each relationship: responsible teams, the contract, the frequency of changes, and an escalation contact. It carries more weight than the picture, which goes stale faster than anyone can update it.
Without a map, what remains is an implicit relationship graph. Team A knows it calls team B, but nobody has said how, who owns the contract, or what happens when someone changes it unilaterally. Implicit relationships lead to integration bugs, creeping model sharing, and eventually a Big Ball of Mud (see 03.12).
How big one Bounded Context is
Evans describes a Bounded Context as a boundary within which one model applies, typically a subsystem or the work of one team [1]. Deployment is not mentioned at all. Fowler goes in the same direction: the boundary is set by human culture and language, and the technical representation is only a consequence. He therefore allows for two contexts inside a single application [3].
In practice there are three levels, which discussions tend to blur into one:
- A Bounded Context is the logical boundary of a model and a language. It answers the question of where the word Order stops meaning the same thing.
- A module projects that boundary into code. In Symfony it is the
App\Orderingnamespace and the directory beneath it. One BC = one module is a reasonable default mapping. - A deployment unit is an operational decision. A modular monolith deploys ten contexts as one application, and the boundaries between them stay valid.
The equation “Bounded Context = microservice” is therefore a shortcut, not a definition. The DDD and Microservices chapter takes it apart, and Subdomains: Core, Supporting, Generic describes how subdomains map onto contexts.
03.02 Eight relationships and roles – an overview#
There are eight named patterns for how Bounded Contexts coexist. Eric Evans described seven of them in Domain-Driven Design (2003) and added Partnership later in the Domain-Driven Design Reference (freely available 2015 edition). Vaughn Vernon extended the catalog with nuances and combinations in IDDD (2013), but the core naming stayed. The taxonomy provides a shared vocabulary (“this is Customer/Supplier, not Conformist”) and makes the cost of coupling visible. Some patterns are more expensive than others, and choosing between them is a strategic decision.
The eight names do not sit on one level. Four of them describe a relationship between two contexts: who pushes on whom and how tightly their release cycles are bound. The remaining four describe the role of one end of an asymmetric relationship: how the upstream enables integration and how the downstream protects itself. Evans says so directly in the definition of Open Host Service. The service provider is thereby placed in the upstream position, every client is downstream, and some clients will be conformists while others build an anti-corruption layer [1]. So the choice is not one of eight options, but a relationship plus the roles at both ends.
Note: In the Domain-Driven Design Reference (2015), Evans lists a ninth pattern besides the eight: Big Ball of Mud, adopted from Foote and Yoder. Section 03.12 Anti-pattern: Big Ball of Mud covers it separately. Unlike the eight patterns below, nobody designs it: it is a state of decay that sets in when no choice is made.
Level 1: the relationship between two contexts.
| Relationship | Symmetry | Model coupling | Planning coupling | Who decides |
|---|---|---|---|---|
| Partnership | symmetric | loose (two models) | tight (joint release) | both teams |
| Shared Kernel | symmetric | tight (shared code) | tight (both must agree) | both teams by agreement |
| Customer/Supplier | asymmetric | loose (translation at the boundary) | medium (negotiation) | upstream, with downstream influence |
| Separate Ways | no relationship | none | none | strategic decision |
Level 2: the role at one end of an asymmetric relationship.
| Role | End | What it does | Downstream coupling to the foreign model |
|---|---|---|---|
| Open Host Service | upstream | publishes one protocol for many consumers | reduces |
| Published Language | upstream + standards | fixes the format and semantics of messages | reduces |
| Conformist | downstream | adopts the foreign model 1:1, without translation | maximal |
| Anti-Corruption Layer | downstream | translates the foreign model into its own | minimal |
The two levels combine. Customer/Supplier commonly uses an Open Host Service as the channel and a Published Language as the message format; at the other end, the downstream builds an ACL or accepts the Conformist role. Vernon (2013) points out that OHS, PL, and ACL appearing together is not a contradiction. For drawing maps, he introduced the abbreviations OHS, PL, and ACL, which the community adopted [2].
03.03 Partnership#
Partnership is a symmetric relationship between two Bounded Contexts whose teams succeed together or fail together. They share a domain goal, coordinate planning, and typically deploy through a joint release process. The integration costs (synchronous meetings, a shared roadmap, frequent merge conflicts) are lower than the price both teams would pay for working independently.
Eric Evans captured the pattern in the Domain-Driven Design Reference (2015). It starts from an observation: where a development failure in either of two contexts would mean a delivery failure for both, cooperation usually emerges on its own. He recommends formalizing it, which means introducing coordinated development planning and joint management of the integration. That is why Partnership is typically not chosen at the drawing board. The map names it and adds a process to it.
Evans also adds a concrete mechanism. A dedicated test suite verifies that the interface meets the expectations of the client system, and it runs in the server system's continuous integration. Without it, all that remains of a Partnership is a calendar of joint meetings.
Example: Catalog BC + Pricing BC in an early-stage startup
A fictional online store: the Catalog team owns product information (name, description, images, categories), and the Pricing team owns pricing (base price, discounts, price A/B tests for different segments). In the early phase they depend on each other in both directions: the product page cannot be shown without a price, and a price without a product has nothing to apply to.
The teams therefore name and formalize the Partnership: one product manager covers both BCs, retrospectives are joint, and the release process is unified (both BCs deploy at the same time). The arrangement works until the domains settle enough to move at their own pace.
Symfony detail: monorepo and a joint release
The directory layout is covered in the section on structuring by subdomain. What matters for Partnership is what the two BCs additionally share in the monorepo: one composer.json, a common DI registration in config/services.yaml, and one message bus configuration in config/messenger.yaml.
Both BCs still keep their own namespaces (App\Catalog, App\Pricing) and their own invariants; the infrastructure (DI container, database server) is shared. They communicate in-process through the synchronous transport of Symfony Messenger, without serialized JSON over the network.
Anti-pattern: “Partnership as the default choice”
A Partnership that arises without the teams consciously choosing it leads straight to a Big Ball of Mud. The typical reason: “we don't have time to agree on things, so we'll do it together.” Aggregates in one BC start reading the other's tables “because it's faster.” Domain events give way to shared service classes. After a year, nobody can say exactly where Catalog ends and Pricing begins.
Signs that a Partnership is no longer working
- Teams start postponing their own features because they are waiting for the other team. Overall velocity drops.
- Retrospectives keep circling around the same cross-team tensions.
- The release process gets longer because coordinating two roadmaps is too expensive.
- One team gets a markedly different priority (for example, Catalog runs an SEO sprint while Pricing works on compliance), and joint deployment loses its reason.
At that point it is time to dissolve the Partnership and move to Customer/Supplier or an Open Host Service between the two BCs.
03.05 Customer/Supplier#
Customer/Supplier is an asymmetric relationship in which the upstream (supplier) provides data or a service and the downstream (customer) consumes it. It differs from Conformist (see below) in that the downstream has a voice. It can explicitly ask the supplier for new features, and the supplier takes them into its backlog and agrees on a date. When and how they are delivered, however, is the supplier's decision.
Evans (2003) warns against both extremes. A downstream team's veto power or cumbersome change-request procedures cripple the upstream's freedom to develop. A downstream without influence, on the other hand, is at the mercy of the upstream's priorities. The solution is a clear customer–supplier relationship: the downstream acts as the upstream's customer in planning meetings, requirements are negotiated and budgeted, and both sides know the commitments and the dates.
Example: Catalog (supplier) → Ordering (customer)
To assemble an order, the Ordering BC needs a product ID and the current price. Catalog manages the product data. Data flows in one direction: Ordering draws from Catalog, and Catalog treats it as a “first-class customer” without losing the freedom to decide about its own model.
When the Ordering team says, “we also need availableStock in the product DTO,” the Catalog team does not do it immediately. It assesses whether the field belongs in the Catalog model. Stock levels are owned by the Warehouse BC (see mapping subdomains onto contexts). Catalog takes only derived availability from it for the product listing, so it can add the field to the product DTO. It therefore schedules the request for the next sprint and delivers it. If the field did not fit the model, Catalog would propose an alternative, for example having Ordering read availability directly from the Warehouse BC API.
Code example: a Symfony Messenger external transport
In Symfony 8, Customer/Supplier is typically built on asynchronous events. Catalog publishes ProductPriceChanged to an AMQP exchange, and Ordering consumes it through its own Messenger transport.
1# config/packages/messenger.yaml – downstream Ordering BC2framework:3 messenger:4 transports:5 from_catalog:6 dsn: '%env(CATALOG_AMQP_DSN)%'7 options:8 exchange:9 name: 'catalog.events'10 type: 'topic'11 queues:12 ordering.from_catalog:13 binding_keys: ['product.price_changed', 'product.discontinued']14 # A service implementing the Messenger SerializerInterface;15 # it translates Catalog's JSON into Ordering's local classes16 serializer: 'App\Ordering\Infrastructure\Messaging\CatalogEventSerializer'17 # A consumer's own serializer is usually decode-only. Retry,18 # however, sends the message back through the same transport's19 # sender, i.e. through encode() - which ends in an exception20 # that crashes the worker. Hence zero retries and straight to21 # the failure transport. Retry belongs here only once the22 # serializer can also encode().23 # Analysis in the DDD and Microservices chapter, section 19.08.24 retry_strategy:25 max_retries: 026 27# The worker handles receiving: php bin/console messenger:consume from_catalog --bus=event.bus28# (a foreign message carries no BusNameStamp; without --bus it would go to the default bus)
And the handler in Ordering:
1<?php2 3declare(strict_types=1);4 5namespace App\Ordering\Application\EventHandler;6 7use App\Ordering\Application\ExternalEvent\ProductPriceChanged;8use App\Ordering\Domain\PriceCache;9use Symfony\Component\Messenger\Attribute\AsMessageHandler;10 11#[AsMessageHandler(bus: 'event.bus')]12final class ProductPriceChangedHandler13{14 public function __construct(15 private readonly PriceCache $priceCache,16 ) {}17 18 public function __invoke(ProductPriceChanged $event): void19 {20 // Ordering keeps a local projection of the price – eventually consistent.21 $this->priceCache->update(22 productId: $event->productId,23 newPrice: $event->newPriceCents,24 currency: $event->currency,25 effectiveAt: $event->occurredAt,26 );27 }28}
A stable contract as the foundation
Customer/Supplier requires a stable contract. Without one, every change to the upstream model is a breaking change for all downstream consumers. In practice it is therefore combined with an Open Host Service as the channel and a Published Language as the message format (sections 03.08 and 03.09).
Planning rituals between teams
Customer/Supplier needs at least minimal coordination rituals:
- Regular joint grooming (typically once per sprint), where the downstream presents its requirements.
- A documented upstream roadmap – the downstream has to see what is coming and when to expect breaking changes.
- An escalation channel – who decides when the teams disagree? Typically a product manager or an architect.
Without them, Customer/Supplier slides into Conformist: the downstream loses its voice and only adapts.
A contract enforced by tests, not by agreement
The rituals cover the organizational half of the pattern. Evans (2003) adds the technical half: jointly developed automated acceptance tests verify the expected upstream interface. They belong in the upstream team's test suite and run in its continuous integration. The upstream can then change the implementation without fear of side effects further down – a broken downstream contract fails the upstream's build, not production at the customer's site.
Today the mechanism has a name and tooling. Ian Robinson described it in 2006 as consumer-driven contracts [4]. The consumer formulates its expectations, and the provider keeps them green in its pipeline. In PHP, Pact from the pact-foundation/pact-php package serves this purpose. It pays off wherever the upstream has more than one consumer and a breaking change is better caught before a phone call reports it.
03.06 Conformist#
Conformist is the downstream's role in an asymmetric relationship: the downstream deliberately gives up its own model and adopts the upstream model 1:1, without translation and without validation. It is a saving at a boundary where fighting for your own model is not worth it.
Evans (2003) describes the situation without embellishment: when the upstream has no motivation to meet the downstream team's needs, the downstream is helpless. Slavishly adopting the upstream model eliminates the complexity of translating between contexts. If the upstream design is good enough or compatible, this need not cause major trouble. Evans names one gain explicitly: you start sharing a Ubiquitous Language with the upstream team.
When to choose Conformist
- An external vendor with no dependent domain logic – data from a SaaS (Stripe, Shopify) is only displayed or forwarded, and fighting its model makes no sense. As soon as your own rules rest on it, such as payments within an order or user identity, an ACL belongs between the SaaS and the domain.
- A regulator – a bank accepts ISO 20022 messages. Fighting the format would mean fighting the standard.
- A reporting or dashboard BC that only receives and displays data.
- A short-term solution until the investment in an ACL pays off.
Example: a Reporting BC accepts Stripe payment objects 1:1
1<?php2 3declare(strict_types=1);4 5namespace App\Reporting\Application;6 7// Conformist: no VOs of our own, we use the Stripe SDK objects directly8use Stripe\PaymentIntent;9 10final class StripePaymentReportRepository11{12 public function __construct(13 private readonly \Stripe\StripeClient $stripe,14 ) {}15 16 /**17 * @return list<PaymentIntent>18 */19 public function getPaymentsInMonth(int $year, int $month): array20 {21 $from = new \DateTimeImmutable(sprintf('%04d-%02d-01', $year, $month));22 23 $payments = $this->stripe->paymentIntents->all([24 'created' => [25 'gte' => $from->getTimestamp(),26 'lt' => $from->modify('+1 month')->getTimestamp(),27 ],28 'limit' => 100,29 ])->autoPagingIterator(); // pages through all payments of the month30 31 return iterator_to_array($payments, false);32 }33 34 public function listMonthlyPayments(int $year, int $month): array35 {36 $payments = $this->getPaymentsInMonth($year, $month);37 38 return array_map(39 // Reporting uses Stripe's fields as they are – currency, amount,40 // status. No translation to a Money VO, no domain terms of our own.41 fn(PaymentIntent $p) => [42 'id' => $p->id,43 'amount' => $p->amount, // Stripe uses cents44 'currency' => $p->currency, // 'usd', 'eur' lower-case45 'status' => $p->status,46 ],47 $payments,48 );49 }50}
Reporting is deliberately a Conformist toward Stripe. No conversion to a Money VO, no translation of 'usd' → Currency::USD. When Stripe renames a field or adds a new status, Reporting accepts the change. The gain is zero investment in an ACL; the price is fragility in the face of incompatible upstream changes.
The Conformist trade-off
Conformist saves:
- Translation code (DTO → VO mapping).
- Understanding two models instead of one.
- Maintaining tests for the ACL layer.
Conformist pays:
- Every incompatible upstream change forces a rewrite of the downstream.
- The downstream's domain logic uses the upstream's terms, and clarity suffers.
- When the upstream discontinues the service, the downstream has to rewrite everything it adopted from that model.
- A second upstream is hard to add (PayPal next to Stripe), because the entire domain logic copies Stripe.
With a proprietary vendor, the balance turns negative as soon as your own domain logic rests on the adopted model: you are taking on a foreign model that changes according to someone else's roadmap. With integration against a standard, it flips. ISO 20022, iCalendar, or CloudEvents define stable, publicly documented concepts that the whole industry reads. Conforming to a standard gives you a shared language with every other market participant.
Conformist as a transitional state
Conformist tends to be acceptable temporarily, for example when a project needs to ship an MVP quickly and integration with the upstream cannot wait. In that case it is reasonable to choose it, but record the technical debt in the backlog: “in 6 months, once we know how we use Reporting, we'll build an ACL.” Without that record, the Conformist “matures” into a permanent solution, and the refactoring becomes twice as painful.
03.07 Anti-Corruption Layer (ACL)#
An Anti-Corruption Layer (ACL) is an isolation layer between the downstream domain model and a foreign (legacy, external, uncooperative) counterpart. It translates in both directions, validates incoming data, and filters out invalid states before they reach the domain. Teams reach for it where the downstream has no influence over the upstream but wants to protect its own model. Mistakes in its implementation tend to be subtle, because foreign terms leak into the domain gradually.
Evans (2003) distinguishes two situations. Between well-designed contexts with cooperating teams, the translation layer can be simple. But when the control or communication needed for a Shared Kernel, Partnership, or Customer/Supplier is missing, translation becomes a defense. The downstream client then creates an isolation layer that gives it access to the upstream system's functionality in terms of its own domain model.
The three responsibilities of an ACL
- Schema mapping – translating data structures: a SOAP response, a REST DTO, or a CSV row into domain VOs and entities. The question is “what does the payload look like?”
- Concept translation – translating the meaning of the data. The upstream uses
customerNumberas an int, the downstreamCustomerIdas a UUID. The upstream has the status"PENDING", the downstream the enumOrderState::AwaitingPayment. The question is “what does it mean?” - Anti-corruption – validation and filtering. Negative amounts, missing required fields, a status outside the known enum, a date in the future – the ACL must reject all of it before it reaches the domain. The question is “can it be trusted?”
Code example: a complete LegacyBillingTranslator
1<?php2 3declare(strict_types=1);4 5namespace App\Ordering\Infrastructure\Acl;6 7use App\Ordering\Domain\Event\InvoicePaid;8use App\Ordering\Domain\ValueObject\InvoiceId;9use App\SharedKernel\Domain\Currency;10use App\SharedKernel\Domain\Money;11use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;12 13/**14 * Upstream DTO: exactly what the legacy SOAP endpoint returns. The domain15 * never sees it - it is the ACL's input, not its output.16 */17final readonly class InvoicePaidSoapResponse18{19 public function __construct(20 public string $invoiceNumber,21 public int $amountInCents,22 public string $status,23 public string $paidAtIso,24 public string $currencyCode = 'EUR',25 ) {26 }27}28 29/**30 * ACL between the legacy Billing system (SOAP) and the Ordering BC.31 *32 * Three responsibilities:33 * 1. Schema mapping – InvoicePaidSoapResponse => InvoicePaid34 * 2. Concept translation – invoiceNumber (string, e.g. INV-2025-00042) => InvoiceId (UUID)35 * 3. Anti-corruption – rejects invalid states from legacy36 */37final class LegacyBillingTranslator38{39 public function translateInvoicePaid(InvoicePaidSoapResponse $r): InvoicePaid40 {41 // (3) Anti-corruption: legacy can send a negative amount as a “credit”42 if ($r->amountInCents < 0) {43 throw new UnrecoverableMessageHandlingException(44 'Negative amount from legacy; credits are not supported in Ordering BC.'45 );46 }47 48 // (3) Anti-corruption: missing identifier49 if ($r->invoiceNumber === '') {50 throw new UnrecoverableMessageHandlingException('Missing invoiceNumber in legacy payload.');51 }52 53 // (3) Anti-corruption: legacy can send a status we don't understand54 if ($r->status !== 'PAID') {55 throw new UnrecoverableMessageHandlingException(56 "Unsupported legacy status '{$r->status}'; expected PAID."57 );58 }59 60 // (3) Anti-corruption: missing date. Without this check,61 // `new \DateTimeImmutable('')` turns an empty string into the current62 // time, and the domain gets “paid right now” instead of an error.63 $paidAt = \DateTimeImmutable::createFromFormat(64 \DateTimeInterface::ATOM,65 $r->paidAtIso,66 );67 68 if ($paidAt === false) {69 throw new UnrecoverableMessageHandlingException(70 "Unparsable paidAt '{$r->paidAtIso}'; expected ISO 8601."71 );72 }73 74 if ($paidAt > new \DateTimeImmutable()) {75 throw new UnrecoverableMessageHandlingException('Legacy sent a future paidAt.');76 }77 78 // (3) Anti-corruption: we translate the currency, we don't overwrite79 // it. A hard-coded EUR would silently change the amount on every80 // invoice in another currency - the anti-corruption layer would81 // corrupt the data itself.82 $currency = Currency::tryFrom($r->currencyCode)83 ?? throw new UnrecoverableMessageHandlingException(84 "Unsupported legacy currency '{$r->currencyCode}'."85 );86 87 // (1) Schema mapping + (2) Concept translation88 return new InvoicePaid(89 invoiceId: InvoiceId::fromLegacy($r->invoiceNumber),90 paidAt: $paidAt,91 amount: new Money($r->amountInCents, $currency),92 );93 }94}
The translator is a final class with a single public method. It has no state, no cache, and no side effects. Its input is the upstream DTO, its output a domain event. The ACL rests on this simplicity; a translator with state and multiple inputs is considerably harder to test and maintain.
Testing the ACL
1<?php2 3declare(strict_types=1);4 5namespace App\Tests\Ordering\Infrastructure\Acl;6 7use App\Ordering\Infrastructure\Acl\InvoicePaidSoapResponse;8use App\Ordering\Infrastructure\Acl\LegacyBillingTranslator;9use PHPUnit\Framework\TestCase;10use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;11 12final class LegacyBillingTranslatorTest extends TestCase13{14 public function testTranslatesPaidInvoice(): void15 {16 $translator = new LegacyBillingTranslator();17 18 $event = $translator->translateInvoicePaid(new InvoicePaidSoapResponse(19 invoiceNumber: 'INV-2025-00042',20 amountInCents: 12_345,21 status: 'PAID',22 paidAtIso: '2025-04-29T10:00:00Z',23 ));24 25 $this->assertSame(12_345, $event->amount->amountInCents);26 $this->assertSame('EUR', $event->amount->currency->value);27 }28 29 public function testKeepsLegacyCurrency(): void30 {31 $translator = new LegacyBillingTranslator();32 33 $event = $translator->translateInvoicePaid(new InvoicePaidSoapResponse(34 invoiceNumber: 'INV-3',35 amountInCents: 100,36 status: 'PAID',37 paidAtIso: '2025-04-29T10:00:00Z',38 currencyCode: 'USD',39 ));40 41 $this->assertSame('USD', $event->amount->currency->value);42 }43 44 public function testRejectsMissingPaidAt(): void45 {46 $translator = new LegacyBillingTranslator();47 48 $this->expectException(UnrecoverableMessageHandlingException::class);49 $translator->translateInvoicePaid(new InvoicePaidSoapResponse(50 invoiceNumber: 'INV-4',51 amountInCents: 100,52 status: 'PAID',53 paidAtIso: '', // an empty field would otherwise translate to “now”54 ));55 }56 57 public function testRejectsFuturePaidAt(): void58 {59 $translator = new LegacyBillingTranslator();60 61 $this->expectException(UnrecoverableMessageHandlingException::class);62 $translator->translateInvoicePaid(new InvoicePaidSoapResponse(63 invoiceNumber: 'INV-5',64 amountInCents: 100,65 status: 'PAID',66 paidAtIso: '2099-01-01T00:00:00Z',67 ));68 }69 70 public function testRejectsNegativeAmount(): void71 {72 $translator = new LegacyBillingTranslator();73 74 $this->expectException(UnrecoverableMessageHandlingException::class);75 $translator->translateInvoicePaid(new InvoicePaidSoapResponse(76 invoiceNumber: 'INV-1',77 amountInCents: -100,78 status: 'PAID',79 paidAtIso: '2025-04-29T10:00:00Z',80 ));81 }82 83 public function testRejectsUnknownStatus(): void84 {85 $translator = new LegacyBillingTranslator();86 87 $this->expectException(UnrecoverableMessageHandlingException::class);88 $translator->translateInvoicePaid(new InvoicePaidSoapResponse(89 invoiceNumber: 'INV-2',90 amountInCents: 100,91 status: 'CANCELLED', // legacy sometimes sends this92 paidAtIso: '2025-04-29T10:00:00Z',93 ));94 }95}
The ACL has no state and a single entry point, so the tests take the shape of two tables: input → output and input → exception. Every new edge case from production arrives as a new test.
Anti-pattern: the leaking ACL
An ACL most often fails when foreign terms start leaking into the domain. Symptoms:
- The domain class
Orderhas a fieldlegacyInvoiceNumber: string. - The domain event
OrderShippedcarriesstripeChargeIdin its payload. - An Application Service checks
$soapResponse->status === 'PAID'. - The ACL class grows to 1,000 lines with many public methods and shared state.
The rule: an ACL holds one responsibility. A layer with dozens of methods and shared state is no longer an ACL. One upstream concept = one translator. Its output is always a domain VO, entity, or event, never a raw DTO. The Microsoft Azure Architecture Center advises the same: keep the layer focused on translation and put neither business rules nor orchestration into it [5]. A business rule in a translator belongs in the domain; orchestration belongs in an Application Service. Extract them.
When not to build an ACL
The ACL gets more space in this chapter than anything else, which makes it tempting to treat it as the default choice. It is not one: the layer has a cost, and in three situations the investment does not pay back.
The first case is a negligible semantic difference. When upstream and downstream use the same terms with the same meaning, the ACL shrinks to an empty mapping layer that copies fields from a DTO into a VO with the same names. The Azure Architecture Center lists this situation as a reason why the pattern may not be suitable [5]. When there is nothing to translate, there is nothing to build.
The second case is latency and operations. An ACL deployed as a separate service adds a network hop, another process to monitor, and another place that has to scale. Under high throughput it becomes a bottleneck, and has to be tuned twice: once for the domain, once for the translation.
The third case is about time. If the legacy system goes away in three months, the investment in a full-fledged layer with a test suite will not pay back. Whether the ACL is a permanent part of the architecture or temporary scaffolding for the migration belongs in the textual description of the relationship on the Context Map. Otherwise the scaffolding stays up forever.
ACL and the Strangler Fig Pattern
The Strangler Fig pattern for gradual migration away from legacy rests on the Anti-Corruption Layer (see the chapter Migrating from CRUD to DDD). Every new BC is separated from legacy by an ACL until the legacy system disappears. Then the ACL usually disappears too, or it simplifies into a pure translator without anti-corruption logic.
03.08 Open Host Service (OHS)#
Open Host Service is the role of an upstream that openly publishes a stable, documented protocol for many downstream consumers. Instead of N different integration agreements (one customer = one contract), it maintains one public protocol, and the downstreams adapt to it.
Evans (2003) starts from the observation that adjusting a translator for each of many integrating neighbors drowns a team. The team therefore defines a protocol that exposes the subsystem as a set of services and opens it to everyone who needs to integrate. The protocol grows with new integration requirements. The exception is the idiosyncratic needs of a single team: a one-off translator handles those, so that the shared protocol stays small and cohesive.
When to choose OHS
- 3+ downstream consumers. With one consumer, an OHS does not pay off; an ad hoc Customer/Supplier is enough.
- A stable domain. The upstream model rarely changes, so the investment in a public protocol pays back.
- Open integration, where the consumer can also be a third party (partners, white-label clients, mobile apps).
Implementation in Symfony 8
In Symfony 8, an OHS typically takes one of these forms:
- A REST API via
api-platform/coreor custom controllers, described by an OpenAPI specification. - gRPC via
spiral/roadrunner-grpc, described by a.protofile. - An event stream published via RabbitMQ / Kafka, described by JSON Schema (the bridge to PL).
Code example: a minimal OHS endpoint with versioning
1<?php2 3declare(strict_types=1);4 5namespace App\Catalog\Infrastructure\Http\OpenHostService;6 7use App\Catalog\Application\Query\GetProductQuery;8use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;9use Symfony\Component\HttpFoundation\JsonResponse;10use Symfony\Component\Messenger\HandleTrait;11use Symfony\Component\Messenger\MessageBusInterface;12use Symfony\Component\Routing\Attribute\Route;13 14final class ProductController extends AbstractController15{16 use HandleTrait;17 18 public function __construct(MessageBusInterface $queryBus)19 {20 $this->messageBus = $queryBus;21 }22 23 /**24 * OHS v1 – a stable contract published in OpenAPI.25 * The version in the URL ('/api/v1/...') is an explicit guarantee that the contract does not change.26 */27 #[Route('/api/v1/products/{id}', name: 'api_v1_product_get', methods: ['GET'])]28 public function getProductV1(string $id): JsonResponse29 {30 $product = $this->handle(new GetProductQuery($id));31 32 return $this->json($product, context: ['groups' => ['ohs.v1']]);33 }34 35 /**36 * OHS v2 – adds the 'availableStock' field. v1 keeps working for old clients.37 */38 #[Route('/api/v2/products/{id}', name: 'api_v2_product_get', methods: ['GET'])]39 public function getProductV2(string $id): JsonResponse40 {41 $product = $this->handle(new GetProductQuery($id));42 43 return $this->json($product, context: ['groups' => ['ohs.v1', 'ohs.v2']]);44 }45}
Serialization groups work only on an object with #[Groups] attributes. When
GetProductQuery returns a plain array, the groups in the context do nothing, and both
versions return the same thing – including fields that v1 promised not to have. The view model
therefore needs the attributes:
1<?php2 3declare(strict_types=1);4 5namespace App\Catalog\Application\Query;6 7use Symfony\Component\Serializer\Attribute\Groups;8 9final readonly class ProductView10{11 public function __construct(12 #[Groups(['ohs.v1'])]13 public string $id,14 #[Groups(['ohs.v1'])]15 public string $name,16 #[Groups(['ohs.v1'])]17 public int $priceCents,18 // Added in v2; the v1 response does not include it.19 #[Groups(['ohs.v2'])]20 public int $availableStock,21 ) {22 }23}
V1 and v2 coexist. A published OHS v1 is a commitment: once some downstream uses it, it must not break. Without explicit versioning it is not an OHS, only “a REST endpoint with insufficient discipline.” Adding a field does not by itself require v2; here v2 only demonstrates versions running side by side.
Versioning strategies
Three common approaches to versioning an OHS:
- Versioning in the URI (
/api/v1/...) – the most readable, cacheable at the HTTP level, recommended for public APIs. - Versioning in a header (
Accept: application/vnd.catalog.v2+json) – cleaner URLs, but harder diagnostics and debugging. - A query parameter (
?api-version=2) – flexible, but it invites “half-versioning,” in which v1 never goes away.
Deprecation policy
An OHS needs a deprecation policy. An example for a public API:
- As soon as a new major version (v3) is released, the documentation marks the older version (v1) as deprecated.
- The headers
Deprecation: @1688169599andSunset: Fri, 31 Dec 2027 23:59:59 GMTare sent with every v1 response. - All known clients get a notice at least 6 months before v1 is removed.
- After v1 is removed, it returns
410 Gonewith a link to the migration guide.
The format of the two headers is prescribed by two different RFCs that often get confused in practice. Deprecation is defined by RFC 9745 (Standards Track, March 2025) as a structured field of type Date, that is, a Unix timestamp prefixed with an at sign [6]. Earlier drafts allowed the value true; it is no longer valid. Sunset comes from RFC 8594 and uses a date in HTTP format [7]. The point in time in Sunset must not precede the one in Deprecation.
03.09 Published Language (PL)#
Published Language is a well-documented, formally specified message format between Bounded Contexts, independent of programming language, framework, and database. Every consumer can read it, validate against it, and generate code from it.
Evans (2003) recommends a well-documented shared language as the common medium of communication, one that expresses the necessary domain information; translation into and out of it happens as needed. What matters is the reasoning for why that language should not be the domain model of one of the contexts directly. A model used as an exchange format freezes. It stops responding to development needs, because every change to it changes the public contract. Vernon (2013) adds that a Published Language reaches further than a schema. It is a Ubiquitous Language for integration: it names the concepts, their invariants, and their semantics.
OHS vs. PL – channel vs. format
The relationship between OHS and PL is often confused. The difference:
- OHS is the channel – a REST endpoint, a gRPC service, an AMQP exchange. “How the data gets out.”
- PL is the format – JSON Schema, OpenAPI, Avro, Protocol Buffers. “What the data looks like and what it means.”
An OHS without a PL is a REST endpoint returning ad hoc JSON that the downstream has no way to validate against. The opposite combination, a PL without an OHS (an Avro schema on disk), fails differently: nobody knows how to get the data. Full-fledged public integration = OHS + PL.
Examples of PL standards
- JSON Schema (json-schema.org) – the most common for REST and event payloads.
- OpenAPI (openapis.org) – a description of a complete REST API, including paths, parameters, and schemas.
- AsyncAPI (asyncapi.com) – the OpenAPI counterpart for asynchronous (event-based) integration.
- CloudEvents (cloudevents.io) – a CNCF specification of an envelope for events (type, source, id, time).
- Avro / Protobuf – binary formats with a mandatory schema, popular for Kafka and gRPC.
Code example: JSON Schema for the OrderPlaced event
1{2 "$schema": "https://json-schema.org/draft/2020-12/schema",3 "$id": "https://example.com/events/order-placed-v1.json",4 "title": "OrderPlaced",5 "description": "Integration event published after an order is successfully placed in the Ordering BC.",6 "type": "object",7 "required": ["eventId", "orderId", "customerId", "totalAmountCents", "currency", "occurredAt"],8 "properties": {9 "eventId": {10 "type": "string",11 "format": "uuid",12 "description": "Unique ID of this event instance (for deduplication on the consumers)."13 },14 "orderId": {15 "type": "string",16 "format": "uuid",17 "description": "ID of the order in the Ordering BC."18 },19 "customerId": {20 "type": "string",21 "format": "uuid",22 "description": "ID of the customer in the Identity BC. Stable across BCs."23 },24 "totalAmountCents": {25 "type": "integer",26 "minimum": 0,27 "description": "Total amount in the smallest currency unit (cents)."28 },29 "currency": {30 "type": "string",31 "pattern": "^[A-Z]{3}$",32 "description": "ISO 4217 currency code (EUR, CZK, USD)."33 },34 "occurredAt": {35 "type": "string",36 "format": "date-time",37 "description": "ISO 8601 timestamp in UTC when the upstream raised the event."38 }39 }40}
The schema is published at the URL https://example.com/events/order-placed-v1.json as the canonical contract that the producer and every consumer validate against. It deliberately omits "additionalProperties": false. The consumer checks the required fields and ignores unknown ones (tolerant reader). A new optional field, such as shippingAddressId, can therefore be added in v1, and consumers start reading it once they need it. An order-placed-v2.json schema comes into being only with a breaking change: removing or renaming a field, or changing its type or meaning. Both versions then coexist for at least the length of the deprecation window.
Validating against the schema in Symfony
1<?php2 3declare(strict_types=1);4 5namespace App\Ordering\Infrastructure\PublishedLanguage;6 7use Opis\JsonSchema\Errors\ErrorFormatter;8use Opis\JsonSchema\Validator;9use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;10 11final class OrderPlacedValidator12{13 public function __construct(14 private readonly Validator $validator,15 ) {16 // The schema URI is an identifier, not a download address.17 // Opis does not go to the network – the file has to be registered.18 $this->validator->resolver()?->registerFile(19 'https://example.com/events/order-placed-v1.json',20 __DIR__ . '/schema/order-placed-v1.json',21 );22 }23 24 public function validate(string $json): void25 {26 $data = json_decode($json, false, flags: JSON_THROW_ON_ERROR);27 28 $result = $this->validator->validate(29 $data,30 'https://example.com/events/order-placed-v1.json',31 );32 33 if (!$result->isValid()) {34 $errors = (new ErrorFormatter())->format($result->error());35 throw new UnrecoverableMessageHandlingException(36 'Payload does not match OrderPlaced v1 schema: ' . json_encode($errors),37 );38 }39 }40}
The example builds on the opis/json-schema library, which returns a structured error description; an alternative is justinrainbow/json-schema. The URI in validate() serves only as the schema identifier. The library does not load it over the network until you register it with registerFile(), registerRaw(), or registerPrefix(). The schema thus stays a versioned file in the repository rather than a remote runtime dependency. On the consumer side, validation against the schema is the first step of the ACL. If the payload does not pass, the validator throws UnrecoverableMessageHandlingException, and the message ends up in the dead letter queue. Without this validation, the downstream BC is exposed to every upstream bug.
03.10 Separate Ways#
Separate Ways is the strategic decision that two Bounded Contexts will not be integrated at all. The team accepts duplicated data or parallel processes, because connecting them would cost more than it brings. It is the only one of the patterns that means “no relationship.”
Evans (2003) points out that integration is always expensive and the benefit is sometimes small. A Bounded Context can therefore be declared as having no connection to the others. Within such a small scope, developers can then find specialized solutions without regard to the rest of the system.
Example: the Marketing BC sends email through its own SendGrid
The Identity BC holds the master list of customers with their preferences. The Marketing BC sends bulk email campaigns. There are two ways to integrate them:
- Identity would publish a
CustomerEmailChangedevent, and Marketing would keep a projection. - Before each send, Marketing would check with Identity whether the customer has opted in.
The marketing team does the math: 50 campaigns a year, while integration costs 200 hours of development and 8 hours of maintenance a month. The risk of a badly synchronized opt-in state stays above zero even with integration. Instead, the team adopts Separate Ways:
- Marketing keeps its own mailing list in SendGrid. Consent to marketing messages is given and withdrawn only there.
- SendGrid records an unsubscribe via the footer link or the
List-Unsubscribeheader in its global unsubscribe list. - Identity knows nothing about marketing consent. The preferences page in the customer account only links to the SendGrid preference center.
The solution has its concessions. The customer manages email somewhere other than the rest of the account, and Marketing cannot target campaigns by data from Identity. In exchange, it is cheap, unsubscribing is as easy as subscribing, and processing for direct marketing stops at once, as required by the GDPR (Art. 7(3) and Art. 21(3)) and by national e-marketing law (in the Czech Republic, Act No. 480/2004 Coll.). The decision was made deliberately and rests on a single condition: consent lives in one place. If customers could also unsubscribe in Identity, Marketing would never find out, and every subsequent campaign would be a violation of the law, not a concession.
When to consider Separate Ways
- Low-value integration – synchronized data would not help users much.
- Expensive synchronization – integration would require distributed consensus, eventually consistent projections, and complex retry logic.
- A short lifespan for one of the BCs – the marketing campaign tool changes every 2 years; investing in deep integration does not pay off.
- An external SaaS without a good API – the integration would be unstable anyway.
Anti-pattern: “Separate Ways out of laziness”
Separate Ways is a strategic decision, not an excuse to avoid work. When a team declares, “we won't integrate this, it's too complicated,” without quantifying the costs and the value, it is not Separate Ways but hidden technical debt. A genuine Separate Ways has a documented alternative (how the problem was solved without integration) and an edge case (what happens when it falls apart).
03.11 A practical procedure – drawing a Context Map in 90 minutes#
A Context Map is not written by one architect alone. It is a team exercise with people who know all the BCs in the system. Recommended group size: 3–8 people. Tools: a whiteboard, sticky notes, and markers. Digital tools (Miro, FigJam) are fine, but a physical whiteboard brings out more tension between teams than an online board does.
Five workshop steps
-
(0–15 min) List all Bounded Contexts. One sticky note per BC, with a name + a one-sentence description (“Catalog: product info,” “Pricing: price including discounts”). More than 12 BCs in one product is a warning sign: you may be modeling too finely. A whole company with dozens of teams naturally has more; the map is then drawn per product.
-
(15–45 min) Draw an arrow for each pair of BCs that interact. Arrow = direction of data flow / causality. Name the relationship (Partnership, Shared Kernel, Customer/Supplier, Separate Ways) and the roles at both ends (OHS, PL upstream; Conformist, ACL downstream). If the team cannot agree (“is it Customer/Supplier or Conformist?”), the relationship is undefined and worth escalating. Mark it with a yellow marker.
-
(45–60 min) Mark the upstream (U) and downstream (D). On each arrow, write U on the side that decides and D on the side that adapts. If nobody knows which is U and which is D, the relationship is not named. Escalate.
-
(60–80 min) Identify “dangerous” relationships. A Conformist toward a fast-changing upstream; a Big Ball of Mud (multiple unnamed relationships between the same BCs); a Shared Kernel that keeps growing; a Partnership that no longer has a domain reason. For each dangerous relationship, create a concrete task (a Jira ticket / an ADR proposal).
-
(80–90 min) Capture the result. Photograph the whiteboard, put it in
docs/context-map.pngin the repo, and accompany it with a Markdown filedocs/context-map.mdthat describes each relationship in text (owner, contract, frequency of changes, escalation contact). Map owner: an architect or tech lead.
What to put in the textual description of a relationship
1## Catalog -> Ordering (Customer/Supplier + OHS + PL)2 3- **Upstream team**: @catalog-team4- **Downstream team**: @ordering-team5- **Channel**: AMQP topic `catalog.events`6- **Schema**: https://schemas.example.com/catalog/product-v2.json7- **Change frequency**: ~once a quarter (minor), once a year (major)8- **Escalation contact**: @lead-architect9- **SLA**: 99.9% of messages delivered within 5 s; an unreadable message goes to the failure transport without retries (`max_retries: 0`)10- **Onboarding**: docs/onboarding/consume-catalog-events.md
Versioning the Context Map
A Context Map is a living document:
- The date of the last update in the footer is mandatory.
- The Markdown and the SVG/PNG live in git and are versioned with the code.
- A review follows every major architectural change (a new BC, a retired BC, a change of relationship type).
- A scheduled review once every 6 months takes place even if nothing “happened.” It often turns out that something did, and nobody documented it.
The map can also be kept as source code. Context Mapper offers a DSL for this that separates the relationship type from the role at its end and generates the diagram in CI. The notation VoyagePlanning [D,ACL] <- [U,OHS,PL] Location says the same as the two tables in section 03.02, but it can be reviewed in a pull request.
One big map of the whole system goes stale fastest. The DDD Crew community practice recommends the opposite: several smaller maps, each for a specific question (“how do we get out of being a Conformist toward billing?”), and for each map, an explanation of the patterns used for the people who decide about them [8].
03.12 Anti-pattern: Big Ball of Mud#
Big Ball of Mud was described by Brian Foote and Joseph Yoder in 1997 in the essay Big Ball of Mud [9]: “A Big Ball of Mud is haphazardly structured, sprawling, sloppy, duct-tape and bailing wire, spaghetti code jungle.” In the language of Context Mapping, it is a system where every BC talks to every other “somehow” and shares database tables, entities, and ad hoc service layers with it. Nobody draws a Context Map, because the relationships are not named.
Symptoms
- A shared database between several BCs, where each BC reads (and often writes) the others' tables.
- Cyclic dependencies between BCs – A calls B calls C calls A.
- Doctrine entities shared between BCs – a single
Orderclass used by Catalog, Pricing, and Billing, each with different expectations. - Service classes with 50+ public methods that “take care of everything.”
- No agreed integration contract – communication through direct DB queries, shared Redis keys, the file system.
- Nobody can say “where one BC ends and the next begins.”
Why it happens
Foote and Yoder point out that Big Ball of Mud is the most widespread architecture in practice. Nobody chooses it; it arises on its own when:
- The team is under pressure to ship functionality fast and has no time to think about boundaries.
- New engineers copy existing patterns that are bad in themselves.
- Architects are missing or ignored.
- Refactoring is politically difficult (it adds risk to short-term delivery).
The way out
Evans's advice in the DDD Reference (2015) sounds surprisingly passive: draw a boundary around the entire mess and declare it a big ball of mud. Inside it, do not attempt sophisticated modeling, and watch for the tendency of such systems to spill into neighboring contexts. It is a defensive measure, not resignation. An unnamed mess keeps growing; a named one at least has a boundary behind which a clean model can defend itself.
From the inside out, Strangler Fig works most often: gradually carve out clean BCs, surround each with an ACL, and move functionality from the old spaghetti layer into the new model. Details in Migrating from CRUD to DDD.
A rewrite from scratch is not taboo, though. Among their seven patterns, Foote and Yoder include Reconstruction: throwing a system away and building it again is an acceptable choice for the original authors, not a failure [9]. The choice between gradual strangling and reconstruction is made by budget and risk, not by faith.
The concrete forms anti-patterns take in PHP and Symfony 8, and strategies for fixing them, are covered in the chapter Anti-Patterns and Common Mistakes.
03.13 Summary#
A Context Map is visual and textual documentation of all Bounded Contexts in a system and the links between them. Above all, it captures the organizational and political reality – who waits on whom, who dictates the format to whom, and who talks to whom at all.
The eight patterns in this chapter do not form one list but sit on two planes. The relationship between two contexts is described by Partnership, Shared Kernel, Customer/Supplier, and Separate Ways; the role of one end of that relationship by Open Host Service and Published Language upstream, and Conformist and Anti-Corruption Layer downstream. The choice is therefore a relationship plus the roles at both ends.
Of the roles, the ACL deserves the most attention. Nearly every nontrivial integration with a legacy or external system calls for one, and it carries three responsibilities: schema mapping, concept translation, and anti-corruption proper. On the upstream side stands the pair of OHS and Published Language, where OHS is the channel and PL the format. Without a versioning policy, though, all that remains of a published contract is a declaration.
When the map cannot be drawn, the system is a Big Ball of Mud. The way out does not start in code, but with a descriptive map of how the system looks today.
Event Storming serves as the discovery workshop for drawing the map: in a single session it reveals both the BC boundaries and the relationships between them. The connection to organizational design is described in the chapter Conway's Law and Team Topologies. According to Conway's Law, architecture copies the communication structure of the organization, so the Context Map and the division of teams have to match each other. Where they do not, the architecture sooner or later adapts to the teams.
Frequently asked questions
How often should a Context Map be updated?
Immediately with every major architectural change (a new BC, a retired BC, a change of relationship type), plus a scheduled review at least once every 6 months. If you do not have time to keep the visual part up to date, keep at least the textual description (docs/context-map.md), which goes stale more slowly than a picture. The date of the last update in the footer is mandatory. Details in the A practical procedure – drawing a Context Map in 90 minutes section.
Can there be more than one type of relationship between two BCs?
Yes, it is common and often necessary. Customer/Supplier describes the organizational relationship (who decides, who asks), Open Host Service describes the technical channel, and Published Language describes the format. These three typically combine into one composite relationship. Anti-Corruption Layer is a role on the downstream side that protects it from the upstream model through translation. In that same position, it is the alternative to Conformist, which accepts the foreign model without translation. When drawing the map, it is enough to write all the relevant stereotypes on the arrow: <<Customer/Supplier>> <<OHS>> <<PL>>.
ACL vs. Adapter – what is the difference?
An Adapter (from Hexagonal Architecture / GoF) is a technical pattern: a class that implements a port and translates calls to a specific library (Doctrine, an HTTP client, Redis). An ACL is a strategic pattern: a layer that protects your domain model from the model of a foreign Bounded Context. An ACL is typically built from Adapters, but not every Adapter is an ACL. It also has three specific responsibilities that an “ordinary” Adapter lacks: schema mapping, concept translation, and anti-corruption (filtering). Details in the Anti-Corruption Layer (ACL) section.
What should I do when I notice a Conformist relationship that should not be there?
Three steps. (1) Verify that it really is an unintended Conformist, because sometimes it is a deliberate strategic decision the team forgot to document. (2) If it is unintended, quantify the cost of fixing it: how many upstream domain terms have leaked into the downstream model, how many tests would need rewriting, and how often the upstream makes breaking changes. (3) Open an ADR (Architecture Decision Record) proposing a migration to an ACL, typically incremental, one translator per sprint. Until the ADR is approved, keep the Conformist as known technical debt in the backlog, not as a surprise in production.
Is a Context Map part of an Architecture Decision Record (ADR)?
A Context Map is not an ADR in itself but a continuously maintained state; an ADR describes a specific decision at a point in time. Every change to the Context Map should have an ADR, though: “We changed the Catalog ↔ Pricing relationship from Partnership to Customer/Supplier because…”. The ADRs then serve as the change history of the Context Map and give future engineers the context for why the map is the way it is. In the repo, the map typically lives in docs/context-map.md and the ADR in docs/adr/0023-split-catalog-pricing.md.
How do I draw a Context Map in text rather than with a tool?
For small systems (up to 5 BCs), a textual Context Map in Markdown is enough. The format: one paragraph per relationship with a bold heading in the form **Catalog -> Ordering**, where the arrow gives the direction (upstream → downstream), and the text gives the relationship type (Customer/Supplier + OHS + PL), the contract, and the contact. Advantages: no tool, git review without pipeline changes, full-text search. Disadvantages: the visual “aha” effect is missing. Recommendation: a textual version always, plus a visual version (PlantUML, Mermaid, Excalidraw) for systems with 5+ BCs. PlantUML source code can be kept next to the Markdown and rendered in CI.
03.14 Further reading#
- Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software, ch. 14 “Maintaining Model Integrity” (Addison-Wesley, 2003) [1].
- Eric Evans, Domain-Driven Design Reference: Definitions and Pattern Summaries (2015) – concise definitions of all patterns, including Partnership and Big Ball of Mud; freely available at domainlanguage.com.
- Vaughn Vernon, Implementing Domain-Driven Design, ch. 3 “Context Maps” (Addison-Wesley, 2013) [2].
- Brian Foote & Joseph Yoder, Big Ball of Mud, PLoP 1997 [9].
- Martin Fowler, Bounded Context (bliki) [3].
- Vaughn Vernon, Domain-Driven Design Distilled (Addison-Wesley, 2016) – a shorter, more accessible version as an introduction to strategic design.
- DDD Crew, Context Mapping shareable resources [8] – a community visual notation for Context Mapping.
- Microsoft Azure Architecture Center, Anti-Corruption Layer pattern [5] – the costs of the layer and situations in which not to build it.
- IETF, RFC 9745 The Deprecation HTTP Response Header Field (2025) [6] and RFC 8594 The Sunset HTTP Header Field (2019) [7].
- Vlad Khononov, Learning Domain-Driven Design (O'Reilly, 2021), ch. 4 “Integrating Bounded Contexts” – a newer take on choosing a pattern by weighing the cost of duplication against the cost of coordination.
- Ian Robinson, Consumer-Driven Contracts: A Service Evolution Pattern [4] – the technical form of the Customer/Supplier relationship.
- Context Mapper – a DSL and map generator that separates the relationship type from the role and keeps the map in git.
- DDD Crew, DDD Starter Modelling Process – where Context Mapping sits among the other strategic artifacts.