Dependency inversion principle (DIP) keeps high-level modules from depending on low-level modules. Instead, program to interfaces rather than implementations, supporting designs that are more flexible and maintainable. section 3.3 section 3.4
Swappable depreciation calculations
An asset-management model gives FundingDetails a DepreciationStrategy interface. Straight-line, declining-balance, double-declining, and no-depreciation implementations can then be exchanged without making the asset model depend on one calculation method. section 3.3
Figure 3.5 We have added a depreciation strategy to our object model. This introduction allows us to swap out the method by which we can calculate the depreciation of an asset.
The diagram makes the abstraction and its concrete depreciation strategies visible, showing how calculation behavior can be swapped. section 3.3





