200
CHAPTER 6 | Tackle Business Complexity in a Microservice with DDD and CQRS Patterns
Figure 7-8 shows a domain entity that implements not only data attributes
but operations or methods
with related domain logic.
Figure 7-8. Example of a domain entity design implementing data plus behavior
A domain model entity implements behaviors through methods, that is, it’s not an “anemic” model. Of
course, sometimes you can have entities that do not implement any logic as part of the entity class.
This can happen in child entities within an aggregate if the child entity does not have any special logic
because most of the logic is defined in the aggregate root. If you have a complex microservice that
has logic implemented in the service classes instead
of in the domain entities, you could be falling
into the anemic domain model, explained in the following section.
Dostları ilə paylaş: