Dependency Inversion Principle vs Dependency Injection

The Dependency Inversion Principle is a software design principle that states that high-level modules should not depend on low-level modules, but rather both should depend on abstractions.

Dependency injection is a technique that allows a programmer to follow the Dependency Inversion Principle by injecting the dependency (i.e., the low-level module) into the dependent object (i.e., the high-level module) at runtime, rather than having the dependent object create the dependency itself.

Leave a Reply

Your email address will not be published. Required fields are marked *