Reputation: 156
While learning domain driven design, I learnt that we should keep two bounded contexts independent from each other. However I am having trouble decoupling two bounded contexts that really dependent on each other.
To be more specific, I am designing a Point Of Sales system. It has a Inventory management subsystem which manages the products in the inventory. It also has a Sales subsystem which is responsible for managing customer orders, transactions. They seem to be separated bounded context, however I can not decouple them:
I know I can use domain event and Saga to replace the cross boundary service calls, however just want to know am I designing this correct? Are Sales and Inventory really belong to two separated bounded contexts?
Upvotes: 1
Views: 873
Reputation: 2893
If you instead separate these in three bounded contexts, you can make these dependencies cycle-free:
Usually sales are completely separated from inventory (i.e., you can make sales w/o having the product available yet). If you have a requirement that only products in stock can be sold, let your UI be responsible for offering only products for sale that are also in stock in your inventory.
Upvotes: 0