In a nutshell

In a nutshell

Allows to provide a different implementation of the same interface at runtime based on some logic.

Some advantages

  • When using injection we can define different behavior for a given dependency, for example, simulated mode for POC testing or demo

Reference:

McLean, H. G. (2017). Adaptive Code: Agile coding with design patterns and SOLID principles, 2nd Edition. Microsoft Press