How will you Partition a typical e-shop into Microservices Architecture

Upasana | May 26, 2019 | 2 min read | 86 views


A service must be small enough to be developed by a small team and to be easily tested. A useful guideline from object-oriented design (OOD) is the Single Responsibility Principle (SRP). The SRP defines a responsibility of a class as a reason to change, and states that a class should only have one reason to change. It make sense to apply the SRP to service design as well and design services that are cohesive and implement a small set of strongly related functions.

Driving Force for Microservices

  1. The architecture must be stable

  2. Services must be cohesive. A service should implement a small set of strongly related functions.

  3. Services must conform to the Common Closure Principle - things that change together should be packaged together - to ensure that each change affect only one service

  4. Services must be loosely coupled - each service as an API that encapsulates its implementation. The implementation can be changed without affecting clients

  5. A service should be testable

  6. Each service be small enough to be developed by a “two pizza” team, i.e. a team of 6-10 people

  7. Each team that owns one or more services must be autonomous. A team must be able to develop and deploy their services with minimal collaboration with other teams.

A business capability is a concept from business architecture modeling. It is something that a business does in order to generate value. A business capability often corresponds to a business object, e.g.

All Microservices should be autonomous by Design, any changes in one microservice shall not impact another.

Partitioning by Business Capabilities

  1. Product catalog management

  2. Pricing Service

  3. Order Management

  4. Inventory Management

  5. Delivery Management

  6. Product Marketing Management

  7. Product Review Service

microservices architecture

Top articles in this category:
  1. 50 microservices interview questions for Java developers
  2. Cracking Spring Microservices Interviews - question bank
  3. Why Microservices are better than Monoliths
  4. Is it a good practice to deploy multiple microservices in a single tomcat container
  5. What is Spring Boot and what are its advantages
  6. Spring Cloud and its advantages

Recommended books for interview preparation:

Find more on this topic: