Assorting large business domains into microservice components

Designing a robust microservices architecture starts by identifying the business domain, defining the capability around that domain, and then defining microservices around it. Breaking down a business domain can be achieved with the concept of Domain-Driven Design (DDD), an approach to software development for complex needs which connects the implementation to an evolving model.

The term DDD was introduced somewhere in 2004 with buzz keywords such as modeling, bounded context, entity, repository, and ubiquitous language. As DDD fits perfectly with the idea of microservices, this concept is again getting hype because of the popularity of microservice architecture. The philosophy of DDD is to try to understand the domain of a problem that we are trying to solve and model it around this domain. It suggests modeling on the basis of real business use cases. This modeling includes defining a set of concepts for domain, capability of domain, and bounded context around it. There are some basic concepts in DDD, which are as follows:

  • Ubiquitous language: This means all the stakeholders (business, operation, developer) should share the common language (terminology) that should not be too technical, rather it should be more focused on the business side model. This language will be related to the bound context of domain.
  • Bounded context: The main idea is to define the scope of a model, to define the clean boundaries of its context, and then do the most possible to keep the model unified. The defined model should be kept consistent and restricted within defined boundaries. Each bounded context should be independent to other context. It defines the separation of duties between the domains. Any particular business can have multiple domains in it such as shipping, inventory, sales, marketing, and so on. Each domain has its own capabilities. Each entity or component of a business remains in its own bounded context. DDD concept helps us identify these domains and their segregation point. This whole concept of DDD matches with microservice principles. Think around a model, encapsulate the model around bounded context, and these contexts define the boundaries.

As microservices should be isolated, it becomes more necessary for a microservice to have a clear responsibility or boundary. When adopting DDD, the bigger problem domain can be decomposed into smaller ones with bounded context, which will lead to a better understanding of defining microservices around them. If we don't do this clear boundary separation, we will have a leakage of responsibility in between microservices, and then we will have a big ball of mud without having any clear boundary. DDD helps in understanding and defining boundary context. A very good read on DDD is Implementing Domain-Driven Design by Vaughn Vernon ,which gives you a deep understanding of Domain-Driven Design.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset