Briefly Exploring the Similarities Between LSP and DIP
Jul 29 2016
What is the relationship between the Dependency Inversion Principle and the Liskov Substitution Principle?
One common thread is dependencies.
Obviously, DIP is about dependencies. It is in the name. The idea is to depend on abstractions instead of concretions. This allows us to substitute any implementation of that abstraction for another. (There are hints of LSP in there.)
But how is LSP about dependencies?
When we adhere to the Liskov Substitution Principle, we set ourselves up to depend on our base class – the abstraction, instead of a subclass – the concretion. (This sounds a lot like DIP.)
Both of these principles encourage flexibility when it comes to the modules that we depend on.
Recent Articles
- Apprenticeship Retro Oct 14 2016
- What the hell is CORS Oct 13 2016
- Cross-site Tracing Oct 11 2016
- Learning Testing Tools First Oct 7 2016