How can I define some rules or additional effects of an action and select it dynamically?
For example, let's imagine a
FinancialProduct, which can be a
Share or a
Bond, each of them having a
Hedge. Now while there are several different kind of
Hedge, their number is still finite and known beforehand, it is just the
FinancialProduct association that can be chosen at runtime (but creating new rulesets at runtime can be interesting too, but one question at a time).
How could I implement this kind of behaviour ?
Hedge business is implemented in a different class, how can it know
FinancialProduct properties and eventually modify them for example? Or modify a property from a different class (a
Portfolio which contains a list of owned or available
FinancialProducts for exemple?)