The metaphor of DCI is a theatre. The context is the director. Chooses who plays what, instruct them how to do it and then let them play.
- Expose use-cases (context) as first-class citizens of your code.
- Each use-case selects which objects are needed for this use-case.
- Extend the objects only with the roles that are needed in this use-case.
- Start the interaction.
Buying a product.
- UserBuysAProduct object, that can be executed.
- Objects/actors needed: user, shop
- Extend user with a Buyer role and shop with ProductCatalogue and OrderManager.
- call shop.buy_product(user, product)