SpineEventEngine / core-java

The Java implementation of the framework core
https://spine.io
Apache License 2.0
36 stars 12 forks source link

One `Model` per bounded context #726

Open dmdashenkov opened 6 years ago

dmdashenkov commented 6 years ago

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 commented 6 years ago

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