0

I am arguing with co worker that a bounded context can be made of other bounded contexts.

My example is:
I am having a tour context made out of

  • flight bounded context
  • hotel bounded context
  • visa bounded context

and he argued that tour is a domain or subdomain, but I think we can interchangeable use domain and bounded context.

Can a bounded context be made up of other bounded contexts?

1

In DDD, if we have a large domain like travel, we would break that into subdomains and create a bounded context for each subdomain.

The subdomains are somewhat independent, interacting with each other but also often directly with the outside world. Each can offer transactional consistency.

A solution can be composed of multiple bounded contexts without necessarily considering the overall solution as its own bounded context.  We would not expect transactional consistency across the bounded contexts, and see compensation (do/undo) used instead.

It would take more than multiple interacting bounded contexts to make a hierarchical composition of a larger bounded context.  We would need ubiquitous language, aggregate roots, a domain model, software, transactions, etc..  Likely a top level bounded context would subsume interaction with the outside world.

I associate the term domain more with the problem space, more with the business space, and the term bounded context more with the solution space, the automation that we bring to enhance the domain (or make the domain viable).

0

A Bounded Context is a self-sufficient module of the system.

Literal answer

Probably not.

While it may be possible, my imagination fails to provide me with a scenario which works from a DDD perspective, and isn't also a purposely flawed design with an obvious fix.

reasoning

It is possible to compose several such modules to create a new module. Usually though this new module does not provide a bounded context that is the super-set of its modules though.

For clarity consider several libraries such as a container library, a streams library, and a mathematics library. Each are separate bounded-contexts in their own business domains.

  • The container library is in the business of structuring elements and managing their life-cycles.
  • The stream library is in the business of inter-process communication (be that sub-process as in pipe and filter architecture, inter-os process, inter-network process, or time delayed/extra-process via a file).
  • The mathematics library is in the domain of a field (or several fields) of math such as trigonometry, tensors, sets, etc...

You would rarely see these modules (and domains) combined into their strict superset: container/stream/maths. You are more likely to see these composed as a Game, a music mixer, or a transaction settlement service. The bounded context of these compositions is vastly different.

Alternate Reading of the question

Can a domain entity exist in more than one bounded context?

Yes

Is that sharing a bounded context?

No

why

Some bounded contexts must communicate with each other. This alone means that they must share some common understanding of the domain. Hence there are two bounded contexts with two identical/similar/related representations of a domain entity.

In a technical sense this domain knowledge might be encapsulated by a library used by both bounded-contexts. This library however is not representative of a bounded-context. On its own it is not a self-sufficient module, because while it facilitates communication, and may contain common manipulations, it is unaware of how each bounded-context will arrange, interact, and react to the communications it represents.

This case

Depends on what you mean by Tour?

Is a Tour a flight+hotel+local activity?

  • Then which bounded-context is responsible for the local activities?

Is a Tour a synonym for a local activity?

  • Then it probably is a separate bound-context in this model.
  • who is responsible for managing the Flight+hotel+visa+tour booking as a whole?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.