I'm facing the issue where either I can't apply DDD, or the case can't be reformulated to fit the DDD rules.
The requirements:
- We have a
ProductandLocation. - Change in
Locationshould be reflected inProductwhich user then sees. ThereforeProductreferencesLocation. - Same
Locationmight be used in severalProducts. Productmight be created and deleted at any time point.Locationmight be created at any time point.Locationmight be deleted only if there is noProductreferences thisLocation.- Delete of a
Productdoes not lead toLocationdeletion.
There are two more entities in the model exist with the same rules as Location, but solution should be the same as with Location case.
My thoughts:
So the problem which I see, that such requirements creates circular dependency on Product and Location. Because they all have own unlimited life cycle they supposed to be separate aggregation roots, but then this violates the consistency boundary, as basically one AR is trying to control another AR. So, this invariant can't be placed in any of those two. Trying to extract this into third one on the top AR also not clear how this would work.
The question:
How can I satisfy such requirements in DDD? Removing the constraint 6 is not an option. I've already tried to negotiate this with business side.
Aucun commentaire:
Enregistrer un commentaire