Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "dependency inversion principle" mean in OOP?

What is meant by the "dependency inversion principle" in object-oriented programming? What does it do?

like image 863
bunty Avatar asked Dec 17 '25 19:12

bunty


1 Answers

In object-oriented programming,
the dependency inversion principle refers to a specific form of decoupling where conventional dependency relationships established from high-level, policy-setting modules to low-level, dependency modules are inverted (e.g. reversed) for the purpose of rendering high-level modules independent of the low-level module implementation details.

The principle states:

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

B. Abstractions should not depend upon details. Details should depend upon abstractions.

Source

like image 123
jmj Avatar answered Dec 20 '25 12:12

jmj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!