201
CHAPTER 6 | Tackle Business Complexity in a Microservice with DDD and CQRS Patterns
That is why microservices architectures are perfect for a multi-architectural approach depending on
each Bounded Context. For instance, in eShopOnContainers, the ordering microservice implements
DDD
patterns, but the catalog microservice, which is a simple CRUD service, does not.
Some people say that the anemic domain model is an anti-pattern. It really
depends on what you are
implementing. If the microservice you are creating is simple enough (for example, a CRUD service),
following the anemic domain model it is not an anti-pattern. However, if you need to tackle the
complexity of a microservice’s domain that has a lot of ever
-changing business rules, the anemic
domain model might be an anti-pattern for that microservice or Bounded Context. In that case,
designing it as a rich model with entities containing data plus behavior as well as implementing
additional DDD patterns (aggregates, value objects, etc.) might have huge benefits
for the long-term
success of such a microservice.
Dostları ilə paylaş: