core-java icon indicating copy to clipboard operation
core-java copied to clipboard

One `Model` per bounded context

Open dmdashenkov opened this issue 6 years ago • 1 comments

Currently, Model is a system-wide singleton. The problem with this is revealed when trying to add more complex validation, e.g. find the correspondence between commands and bounded contexts.

In order to make Model agiler, and also prohibit inadequate access to the Model instances, we should turn it into a per-BC concept.

dmdashenkov avatar Jun 25 '18 16:06 dmdashenkov

The suggested approach is to produce strict rules on what a bounded context is at compile time.

This can be done by introducing module annotation @BoundedContext and consider this module to contain the definition of the bounded context.

scheme

dmdashenkov avatar Jun 25 '18 16:06 dmdashenkov