100
CHAPTER 5 | Designing and Developing Multi-Container and Microservice-Based .NET Applications
Figure 6-2. External versus internal architecture and design
For instance, in our
eShopOnContainers
sample, the catalog, basket, and user profile microservices are
simple (basically, CRUD subsystems). Therefore, their internal
architecture and design is
straightforward. However, you might have other microservices, such as the ordering microservice,
which is more complex and represents ever-changing business rules with a high degree of domain
complexity.
In cases like these, you might want to implement more advanced patterns within a
particular microservice, like the ones defined with domain-driven design (DDD) approaches, as we are
doing in the
eShopOnContainers
ordering microservice. (We will review these DDD patterns in the
section later that explains
the implementation of the
eShopOnContainers
ordering microservice.)
Another reason for a different technology per microservice might be the nature of each microservice.
For example, it might be better to use a functional programming language like F#, or even a language
like R if you are targeting AI and machine learning domains, instead of a more object-oriented
programming language like C#.
The bottom line is that each microservice can have a different internal architecture based on different
design patterns. Not all microservices should be implemented using advanced DDD patterns, because
that would be over-engineering them. Similarly, complex microservices with ever-changing business
logic should not be implemented as CRUD components, or you can end up with low-quality code.
Dostları ilə paylaş: