(DIP) Dependency Inversion Principle

The Dependency Inversion Principle (DIP) is one of the five principles of object-oriented programming and design, as described in Robert C. Martin's book, "Agile Software Development, Principles, Patterns, and Practices." The principle states that:

"High-level modules should not depend on low-level modules. Both should depend on abstractions."

The main idea behind this principle is to decouple the various components of a system, so that they can be developed and maintained independently. This makes it easier to change the implementation of a low-level component without affecting the high-level component, and vice versa. To achieve this, abstractions should be defined that define the interface between the components, and both high-level and low-level components should depend on these abstractions rather than on each other.

The DIP is important for creating loosely coupled systems, which are easier to maintain, extend, and test. By following the DIP, developers can write more flexible and scalable software systems, and reduce the risk of unexpected behavior or side effects when making changes to the code.

http://principles-wiki.net/principles:dependency_inversion_principle