DDD exposes bounded contexts, domain models, aggregates... but I often miss the keypoint of business rules. I would like to know how business rules integrate into this approach. Here is an example :
Imagine you have 2 bounded contexts in a credit company. One for debt recovery, the other for early refunds. These contexts embed real business specificities. In a conceptual point of view, I think these bounded contexts should separately embed common model parts, and similar domain model entities (graph of 3 or 4 accountancy entities). Even if their respective models embed a common submodel (we do not plan it can change), business rules that apply to these submodels are different. A DebtRecoveryService ensures rules are correctly applied, and another EarlyFundsService does the same, with specific accountancy rules.
- Should this submodel be embedded and "served to others" by another dedicated bounded context if different business rules apply to them (in terms of maths and respective behaviours ?).
- What defines an aggregate, is it only a part of a model ?
- Do specific business rules define specific aggregates ?
Do you think an aggregate should be considered only for the entity graph it represents, and be "reused" by other bounded contexts. Is it a good case for CQRS ?
Thanks,