EMZETT.
Login

DIP

In short: The dependency inversion principle (DIP) states: high-level modules should not depend on low-level modules, both depend on abstractions.

In more detail: The “D” in SOLID. Dependencies point to interfaces, not to concrete classes.

In Depth

Example

An OrderService uses a Storage interface. Whether a database, file or test mock is behind it is decided from outside (dependency injection).

Benefit

Exchangeable parts, easier tests, loose coupling. See ISP, OCP, interface.

See also: SOLID-Prinzipien, ISP, OCP, Interface