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:
- An order [in Sales context] has reference to a product [in inventory context].
- When user paying an order [which is done in Sales context], the product quantity should be decreased [which is done in inventory context].
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?