"매 모두 의 language = 매 아무도 의 language". 매 specific domain 의 internal 의 의미 boundary. 매 같은 word ('Account' = bank 의 계좌 vs login 의 ID) 의 isolation. 매 DDD 의 핵심. 매 microservice boundary 의 base.
📖 핵심
매 정의 (Eric Evans)
매 model 의 explicit boundary.
매 ubiquitous language 의 작동 region.
매 team / responsibility 의 align.
매 typical example
Context
"Customer" 의 의미
Sales
매 prospect / lead
Support
매 ticket 의 owner
Billing
매 payment account
Shipping
매 delivery address
Marketing
매 segment member
→ 매 같은 entity 가, 매 different attribute / behavior.
Ubiquitous Language
매 같은 word = 매 같은 meaning (within BC).
매 dev + PO + designer + business 의 share.
매 documentation, code, conversation 의 일관.
Context Map (relationship type)
관계
설명
Shared Kernel
매 공통 model 의 share (위험)
Customer-Supplier
매 upstream-downstream 의 협력
Conformist
매 downstream 의 upstream 의 그대로 따름
Anti-Corruption Layer (ACL)
매 boundary 의 translation
Open Host Service
매 well-defined API
Published Language
매 cross-context 의 standard format
Separate Ways
매 integration X
Big Ball of Mud
매 unstructured (anti-pattern)
매 size 의 trade-off
매 너무 작 → 매 distributed monolith.
매 너무 큼 → 매 god service.
매 sweet spot: 매 single team 의 own 의 가능.
매 modular monolith vs microservice
접근
When
Modular monolith
매 boundary 의 unclear / 매 small team
Microservice
매 boundary 의 stable / 매 scale need
Strangler Fig
매 legacy 의 incremental migrate
→ "Microservices first" 의 보통 wrong. 매 modular monolith → 매 split.
매 strategic vs tactical DDD
Strategic: 매 BC + 매 context map.
Tactical: 매 entity / value object / aggregate / domain event.
Event Storming
매 BC discovery 의 workshop.
매 domain event 의 sticky note.
매 aggregate / actor / policy 의 emerge.
매 modern DDD 의 entry.
매 modern variant
매 DDD-Lite (lightweight).
매 Team Topologies (Stream-Aligned + Platform + Enabling + Complicated Subsystem).
매 Conway's Law: 매 architecture = 매 organization.
💻 패턴
Module per BC (TS)
src/
├── billing/ # 매 BC 1
│ ├── domain/ # 매 entity, value object
│ ├── application/ # 매 use case
│ └── infrastructure/
│
├── shipping/ # 매 BC 2
│ ├── domain/
│ ├── application/
│ └── infrastructure/
│
└── shared/ # 매 ACL / published language
└── events/
Anti-Corruption Layer
// 매 external system (legacy CRM) 의 different model
import{LegacyCRMClient}from'./legacy-crm';interfaceDomainCustomer{id: CustomerId;email: Email;preferences: Preferences;}// 매 ACL — 매 legacy → 매 our domain
classCRMAdapter{constructor(privatelegacy: LegacyCRMClient){}asyncgetCustomer(id: string):Promise<DomainCustomer>{constraw=awaitthis.legacy.fetchUser(id);// 매 messy
return{id: CustomerId.parse(raw.user_id_v2),email: Email.parse(raw.contact?.email_addr??raw.email),preferences: this.translatePrefs(raw.flags),};}privatetranslatePrefs(flags: number):Preferences{// 매 magic bitmap → 매 typed
return{newsletter:!!(flags&1),sms:!!(flags&2)};}}
Domain event (cross-BC communication)
// 매 billing BC
classOrder{pay(amount: Money){// ... domain logic
this.events.push(newOrderPaid(this.id,amount));}}// 매 published language
typeOrderPaid={type:'order.paid';version:'1.0';orderId: string;amount:{value: number;currency: string};occurredAt: string;};// 매 shipping BC 의 subscribe
@EventHandler('order.paid')classStartShipment{asynchandle(event: OrderPaid){awaitthis.shipmentRepo.create({orderId: event.orderId});}}
1. 매 BC 의 module 의 만들기 (modular monolith).
2. 매 module 의 internal 의 사용 의 measure.
3. 매 stable boundary 의 confirm.
4. 매 module 의 service 의 extract:
- 매 module API 의 → REST / gRPC / event.
- 매 in-process call 의 → network call.
- 매 separate database (own data).
5. 매 deployment / monitoring 의 separate.
Strategic Design Workshop
# 매 BC 의 workshop outputbounded_contexts:- name:Billingteam:Payments Teamubiquitous_language:- Invoice:"매 customer 의 charge 된 amount"- LineItem:"매 invoice 의 row"aggregates:[Invoice, Subscription]upstream:[]downstream:[Notification, Reporting]relationship:{Reporting:'OHS'}- name:Notificationupstream:[Billing, Shipping]relationship:{Billing:'Conformist'}
🤔 결정 기준
상황
Approach
New project
Modular monolith + clear BC
Legacy mess
Strangler Fig + extract BC 의 1 by 1
Cross-BC sync need
Event-driven
Cross-BC sync stronger
API + ACL
Single team
1 BC
Multi-team
1 BC / team
External system
ACL
Published format need
Published Language
기본값: Modular monolith → 매 BC 의 stabilize → 매 microservice.