Part 1 of 6 · 1 min read
Why this page comes fifth
In this module you will
- State the dependency inversion principle (DIP) in plain words.
- Say which dependencies to avoid and which are safe.
- Rewrite a class so that it receives an interface instead of creating a concrete class.
- Explain why "inversion" is a good name, using the direction of arrows.
- Show how this makes testing easy with a fake.
Module 2 said that old code stays closed when it depends on an interface. This page names that habit and gives its rule, the last of the five SOLID principles (SRP, OCP, LSP, ISP, DIP). The source is "Clean Architecture" (CA), chapter 11. Code was compiled and run before it was written here. Numbers marked "made up" only show the idea.