← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Context Mapping

architecture Advanced
debt(d7/e7/b8/t7)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). While deptrac can enforce some boundary constraints, context mapping as a strategic design practice—identifying team relationships, power dynamics, and integration patterns—cannot be automated. Detection requires careful architectural review and organizational analysis. The absence of documented boundaries or the wrong integration pattern choice only surfaces through code review or when integration pain emerges over time.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7). The quick_fix suggests drawing a map with your team, but actually remediating a wrong context relationship (e.g., switching from Conformist to ACL when the upstream pollutes your domain) requires introducing translation layers, potentially restructuring module boundaries, and coordinating across teams. This is cross-cutting work that touches multiple bounded contexts.

b8 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (b8), +1 from b7. Context maps define the fundamental integration architecture between bounded contexts. Per the common_mistakes, undocumented integrations produce the worst coupling, and Conway's Law means team changes affect integration patterns. Every cross-context feature, every API change, every team restructuring is shaped by these decisions. Applies to web and cli contexts—essentially all PHP application types.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t7). The misconception explicitly states developers think context mapping is 'just API design' when it actually defines organizational relationships and power dynamics that determine what integration patterns are feasible. This contradicts how developers typically think about system integration—they focus on technical contracts rather than team dynamics. Choosing Conformist when ACL is needed, or Shared Kernel for convenience, are traps that seem reasonable but produce unmaintainable codebases.

About DEBT scoring →

Also Known As

bounded context integration DDD context map upstream downstream

TL;DR

A DDD strategic pattern that maps the relationships between bounded contexts — defining integration patterns like Anti-Corruption Layer, Shared Kernel, and Customer-Supplier.

Explanation

Context mapping identifies how different bounded contexts relate to each other: which is upstream (produces) and downstream (consumes), and what integration pattern is appropriate. Patterns: Partnership (collaborate closely), Shared Kernel (shared model subset), Customer-Supplier (upstream provides, downstream requests), Conformist (downstream adopts upstream model), ACL (downstream translates), Open Host (upstream publishes a protocol), Published Language (formal exchange format). The context map is a team topology tool as much as a technical one.

Diagram

flowchart LR
    subgraph Upstream
        CRM[CRM System<br/>legacy]
        BILLING[Billing<br/>Service]
    end
    subgraph Downstream
        ORDER[Order<br/>Service]
        REPORT[Reporting<br/>Service]
    end
    CRM -->|Conformist or ACL| ORDER
    BILLING -->|Open Host Service| ORDER
    BILLING -->|Published Language| REPORT
    ORDER -->|Customer-Supplier| REPORT
style CRM fill:#f85149,color:#fff
style ORDER fill:#238636,color:#fff
style REPORT fill:#1f6feb,color:#fff

Common Misconception

Context mapping is just API design — it defines the organisational relationships and power dynamics between teams, which determines what integration pattern is even feasible.

Why It Matters

Context maps prevent integration anti-patterns — a Conformist relationship between two teams where the downstream should have an ACL produces an unmaintainable codebase when the upstream changes.

Common Mistakes

  • Not mapping all contexts — undocumented integrations are the ones that produce the worst coupling.
  • Choosing Shared Kernel for convenience — it requires joint ownership and coordination; it is often the wrong choice.
  • Conformist when ACL is needed — absorbing an upstream model directly pollutes the downstream domain.
  • Not updating the context map when team structures change — Conway's Law means team changes affect integration patterns.

Code Examples

✗ Vulnerable
// Conformist — downstream absorbs upstream model uncritically:
// Legacy CRM uses 'CUSTNO', 'ACCT_STATUS_CD', 'AMT_OUTSTANDING'

class InvoiceService {
    public function generateInvoice(string $custNo, string $acctStatusCd): Invoice {
        // Upstream's naming convention pollutes the entire downstream domain
        // Every developer must know what ACCT_STATUS_CD means
    }
}
✓ Fixed
// ACL pattern — downstream translates upstream model:
class CrmTranslator {  // Anti-Corruption Layer
    public function toCustomer(array $crmData): Customer {
        return new Customer(
            id: new CustomerId($crmData['CUSTNO']),
            status: match($crmData['ACCT_STATUS_CD']) {
                'A' => CustomerStatus::Active,
                'S' => CustomerStatus::Suspended,
            },
            balance: Money::fromCents((int)($crmData['AMT_OUTSTANDING'] * 100), 'GBP'),
        );
    }
}

Added 15 Mar 2026
Edited 22 Mar 2026
Views 48
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 1 ping T 3 pings W 2 pings T 5 pings F 0 pings S 0 pings S 0 pings M 1 ping T 2 pings W 1 ping T 2 pings F 0 pings S
No pings yet today
ChatGPT 1
ChatGPT 21 Amazonbot 10 Perplexity 6 Google 3 Ahrefs 1
crawler 38 crawler_json 3
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: High
⚡ Quick Fix
Draw a context map with your team — identify which bounded contexts you own, which are external, and what relationship pattern exists between each pair (conformist, ACL, partnership)
📦 Applies To
any web cli
🔗 Prerequisites
🔍 Detection Hints
No documented team/context boundaries; shared database across multiple logical domains; no explicit integration patterns defined
Auto-detectable: ✗ No deptrac
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: High Context: File Tests: Update

✓ schema.org compliant