Microservices with Clojure
上QQ阅读APP看书,第一时间看更新

Bounded context

A domain model is a conceptual model of a business domain that formalizes its behavior and data. A single unified domain model tends to grow in complexity with business capabilities and increases the collaboration overhead among the team due to high coupling. To reduce coupling, domain-driven design recommends defining a model for each business capability with a well-defined boundary to separate the domain concepts within the model from the ones outside. Each such model then focuses on the behavior and data confined to a single business capability, and thus gets bounded by a single application context, called a bounded context. Monolithic applications tend to have a unified domain model for the entire business domain, whereas for microservices, domain models are defined for each identified bounded context.

For example, instead of defining a single unified domain model for an e-commerce application, it is better to divide the application into bounded contexts of Customer, Sales, and Marketing and define a domain model for each of these contexts, as shown in the preceding diagram. Such focused domain models can then conquer each context based on business capabilities. For example, Customer Context can focus only on user and profile management, Sales Context can handle orders and transactions, and Marketing Context can keep track of user interests for focused marketing.