Home Computer Science Microservices Flexible Software Architecture
Building blocks such as Aggregate represent for many people the core of DDD. DDD describes, along with strategic design, how different domain models interact and how more complex systems can be built up this way. This aspect of DDD is probably even more important than the building blocks. In any case it is the concept of DDD, which influences microservices.
The central element of strategic designs is the Bounded Context. The underlying reasoning is that each domain model is only sensible in certain limits within a system. In e-commerce, for instance, number, size, and weight of the ordered items are of interest in regards to delivery, for they influence delivery routes and costs. For accounting on the other hand prices and tax rates are relevant. A complex system consists of several Bounded Contexts. In this it resembles the way complex biological organisms are built out of individual cells, which are likewise separate entities with their own inner life.
Bounded Context: An Example
The customer from the e-commerce system shall serve as an example for a Bounded Context (see Figure 3.4). The different Bounded Contexts are Order, Delivery, and Billing. The component Order is responsible for the order process. The component Delivery implements the delivery process. The component Billing generates the bills.
Figure 3.4 Project by Domains
Each of these Bounded Contexts requires certain customer data:
In this manner each Bounded Context has its own model of the customer. This renders it possible to independently change microservices. If for instance more information regarding the customer is necessary for generating bills, only changes to the Bounded Context billing are necessary.
It might be sensible to store basic information concerning the customer in a separate Bounded Context. Such fundamental data is probably sensible in many Bounded Contexts. To this purpose the Bounded Contexts can cooperate (see below).
A universal model of the customer, however, is hardly sensible. It would be very complex since it would have to contain all information regarding the customer. Moreover, each change to customer information, which is necessary in a certain context, would concern the universal model. This would render such changes very complicated and would probably result in permanent changes to the model.
To illustrate the system setup in the different Bounded Contexts a Context Map can be used (see section 7.2). Each of the Bounded Contexts then can be implemented within one or several microservices.
|< Prev||CONTENTS||Next >|