For example, as part of an order entity class you must have business logic and operations implemented as methods for tasks such as adding an order item, data validation, and total calculation. The context of each microservice or Bounded Context impacts its domain model.ĭomain entities must implement behavior in addition to implementing data attributes.Ī domain entity in DDD must implement the domain logic or behavior related to the entity data (the object accessed in memory). But the buyer entity in the ordering microservice might have fewer attributes, because only certain buyer data is related to the order process. Instead, entities in each Bounded Context limit their attributes and behaviors to those required in that Bounded Context's domain.įor instance, the buyer entity might have most of a person's attributes that are defined in the user entity in the profile or identity microservice, including the identity. However, that does not imply that the same entity, with the same attributes and logic would be implemented in multiple Bounded Contexts. The same identity (that is, the same Id value, although perhaps not the same domain entity) can be modeled across multiple Bounded Contexts or microservices. Therefore, you should identify and design them carefully.Īn entity's identity can cross multiple microservices or Bounded Contexts. As Eric Evans says, "an object primarily defined by its identity is called an Entity." Entities are very important in the domain model, since they are the base for a model. The Domain Entity patternĮntities represent domain objects and are primarily defined by their identity, continuity, and persistence over time, and not only by the attributes that comprise them. The domain model must capture the rules, behavior, business language, and constraints of the single Bounded Context or business microservice that it represents. Keep in mind, however, that a BC or business microservice could sometimes be composed of several physical services that share a single domain model. Your goal is to create a single cohesive domain model for each business microservice or Bounded Context (BC). Define one rich domain model for each business microservice or Bounded Context.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |