Skip to content

Dependency Inversion Principles (DIP)

Mehmet Özkaya edited this page Mar 24, 2019 · 2 revisions

To summarize the term dependency briefly, we can explain that a class is dependent on another class, that is, a class needs another class to work. As we see in the figure below, the upper-level layer uses the lower-level layer (classes, interfaces, etc.). we can say that the level is dependent on the layer. As for the term reusability; Firstly, we think that a class can be written and used in various parts of the project, but we can define a code that we use as a real reuse and a higher level library can be used in other projects without touching the code. We cannot do this because of the interdependence of classes in well-designed software. At this point, Dependency Inversion Principle (DIP), which is an important software principle that needs to be implemented in order to develop more flexible and reusable modules, comes into play. Briefly explain this method;

Upper-level modules, classes, etc., lower-level classes must not be dependent on modules. Lower-level modules must be dependent on higher-level modules (interfaces of modules). For short, we call it Dependency Inversion.

Clone this wiki locally