Alejandro G. Carlstein Ramos Mejia Blog

 icon-angle-left Micro-services: Design Principles Introduction | Microservices: Technology icon-arrow-right 

Summary of Principles to Implement

  • High Cohesion: Small micro-service focused and single functionality.
    • Single focus.
    • Do a single thing and do it well done.
  • Autonomous: Allow upgrade of different part without risking other parts in the system.
    • Independently changeable.
    • Independently deployable.
  • Business Domain Centric: aligned with the overall organization structure.
    • Represent a business function or domain.
  • Resilience:
    • Embrace failure.
    • Degrade or default functionality when failure detected.
  • Observable: so we can have an overall view of the health of the system.;
    • Centralized Monitoring.
    • Centralized Logging.
  • Automation: in order to administrate the complex system.
    • Tools:
      • Testing.
      • Feedback.
      • Deployment.

High Cohesion Design Principle

In order to implement a micro-service with high cohesion, we need to:


 icon-angle-left Microservices | Microservices: Design icon-angle-right 

Design Criteria

In order for a service to be a microservice, it must match the following criteria:

  • It needs to be have high cohesion.
  • It needs to be autonomous.
  • It must be business domain centric.
  • It must have resilience.
  • It must be observable.
  • Automation should be used throughout the development process.

High Cohesion

  • The microservices functionality and content in terms of input and output must be coherent.
    • It must have a single focus, and do it well.
      • This principle allows to control the size of the service.
      • It prevent to create a monolithic service by attaching other behaviors into the microservice which may not be related.
    • It must follow the Single Responsibility Principle.
      • A class can only change for one reason.
        • A business function.
        • A business domain.
      • Check SOLID principles for more information.
    • e.: If your microservice takes care of the postage, then all the input, output and process should be focus around the postage.
  • It is like encapsulation principle from OOP programming principles.
    • Take all the data and functionality that’s related and put them together in one package.
  • This principle makes the microservice easier to rewrite.
  • This makes the system highly scalable, flexible and reliable.
    • We can scale up individual microservices which represent a specific business function or business domain.
    • The system is more flexible because we can change or upgrade the functionality of specific business functions or domains.
    • The system have reliability because we are changing specific small parts with in the system without affecting the other parts.