5. The Dependency Inversion Principle
(1)Zeist, The Netherlands
The last of the SOLID principles of class design focuses on class
dependencies. It tells you what kinds of things a class should depend on
1:
Depend on abstractions, not on concretions.
The name of this principle contains the word “inversion,” from which we may infer that without following this principle we would usually depend on concretions, not on abstractions. The principle tells us to invert that direction: we should always depend on abstractions.
Example of Dependency Inversion: the FizzBuzz Generator
There is a well-known programming assignment that serves ...