2
votes

I have been learning to implement Microservices but I could not understand the term "bounded context"?

I could understand that it is concept which arises out of Domain Driven Design. But I could not understand the technical implementation of it.

I have looked at below links:

  1. microservices and bounded contexts
  2. https://martinfowler.com/bliki/BoundedContext.html
  3. https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/microservice-ddd-cqrs-patterns/microservice-domain-model
2
What part do you not understand (exactly)? Saying "the technical implementation" is too broad. - Elliott Frisch
@Sam see my updated answer - Constantin Galbenu

2 Answers

8
votes

It is the bigest zone/area/place where a term has a consistent meaning (it means the same thing for the business specialists and the developers). I intentionally avoid to use the word "context". Ideally, a Bounded context is exactly a Domain from the real world.

When it comes to microservices, a microservice should not be larger than a Bounded context.

UPDATE

A Bounded context should be an independent domain, if the system is correctly designed; in reality, when things are not done correctly, a Bounded context is larger than a domain. In large enterprises, some developers create objects (models) that try to capture all the behavior related to some term. For example, Product in a Shop. This term is very broad. The Product from the online-shop and the Product from the inventory system are not one and the same thing, although they may seem that way. In this case, the online-shop should be bounded context and the inventory should be a different one.

Implementation

Each "product" should have a different class in each bounded context, for example. A bounded context can be implemented as (a better expression would be "can be seen as") a namespace or package in monoliths, or as a microservice in distributed systems.

1
votes

Bounded Context is an independent domain. Let's imagine it as a different department in a company. Something like separation of concerns. An independent context in which all the stakeholders (Business Analysts, Testers, Developers, Business Folks) have the same definition of terms used in the Bounded Context. You can then have a separate microservice corresponding to each Bounded Context. For Example: If you in Insurance Domain, then you can have bounded context like Customer, Quote, Policy etc. and can have a micro-service for each of them.