Domain-driven design (DDD) by Eric Evans (Addison-Wesley, 2004) should occupy an honored place on every software engineer's bookshelf. This is because it defines and formalizes an important theoretical basis for a successful microservices architecture. DDD establishes a common vocabulary (namely, context, domain, model, and ubiquitous language) and formulates a set of principles for maintaining model integrity. One of the most important consequences of DDD is that individual bounded contexts defined in terms of DDD are usually mapped into separate microservices, demonstrated as follows:
Since DDD is very focused on the business core domain, especially on artifacts to express, create, and retrieve domain models, the following objects will often be referenced during this chapter—entity, value objects, aggregate, repository.
During application implementation with DDD in mind, the preceding objects should be mapped to the application persistence layer if such a layer is present in the service. Such a domain model formulates the basis for logical and physical data models.