Search code examples
oopdesign-patternsarchitecturemicroservicese-commerce

What design patterns are used in an ecommerce web apps?


What design patterns are commonly used or used together in developing e-commerce with microservices or multi-tier layer architecture? Let's say we will write the code using object-oriented language such as Java or .NET 5 just for an example and we develop the client app using a JavaScript framework.

Would the design patterns suggestion change if I choose to implement a microservices architecture?


Solution

  • There is a pattern called "Pattern: Microservice Architecture:"

    Define an architecture that structures the application as a set of loosely coupled, collaborating services. This approach corresponds to the Y-axis of the Scale Cube. Each service is:

    • Highly maintainable and testable - enables rapid and frequent development and deployment
    • Loosely coupled with other services - enables a team to work independently the majority of time on their service(s) without being impacted by changes to other services and without affecting other services
    • Independently deployable - enables a team to deploy their service without having to coordinate with other teams
    • Capable of being developed by a small team - essential for high productivity by avoiding the high communication head of large teams

    Services communicate using either synchronous protocols such as HTTP/REST or asynchronous protocols such as AMQP. Services can be developed and deployed independently of one another. Each service has its own database in order to be decoupled from other services. Data consistency between services is maintained using the Saga pattern

    To learn more about the nature of a service, please read this article.

    And e-commerce application is considered as an example to apply pattern: Microservice Architecture.

    So it is possible to create multiple services divided by entities or business domains:

    • customers
    • inventory
    • shipping

    Then it is necessary provide the way of communication among services. It can be event streaming platform Kafka.