Article
Strategic Domain-Driven Design
Mar 7, 2025 · 12 min
Domain-Driven Design offers strategic patterns that decide whether a large system stays coherent as it grows. Applied in Kotlin, the type system gives domain modeling a real edge.
Bounded contexts
A Bounded Context defines the scope within which a single model applies, so a team can speak one Ubiquitous Language without colliding with neighbouring contexts.
One model, one language, one boundary. Cross a boundary and you translate; you don’t share.
Context mapping
When contexts meet, name the relationship: partnership, customer-supplier, or a defensive Anti-Corruption Layer. In Kotlin, a sealed hierarchy keeps the model’s states honest:
sealed interface Order {
data class Draft(val lines: List<Line>) : Order
data class Placed(val id: OrderId, val at: Instant) : Order
}
Domain events
Events let contexts stay decoupled while still telling each other what happened. See the Domain Event concept for the evergreen reference.