Skip to main content
InterviewHubPRO
Section Overview
Q40

Question 40 of 50

Part 3: Enterprise Architecture, Package Design & Enforcement (25 - 35)

80%
SOLID & OOP Principles (50 Qs)•Part 3: Enterprise Architecture, Package Design & Enforcement (25 - 35)

Dependency Inversion Principle (DIP) vs Inversion of Control (IoC) vs Dependency Injection (DI).

senior LevelMost AskedDependency InjectionSystem Design

In Simple Words: Clarifying the three frequently confused terms:

  1. DIP (Architectural Principle): High-level business logic modules must not depend on low-level implementation modules (databases, APIs). Both must depend on abstractions (interfaces).
  2. IoC (Design Pattern / Concept): Inverting the traditional control flow. Instead of your custom code calling a framework library, the framework calls your custom code (the "Hollywood Principle": Don't call us, we'll call you).
  3. DI (Implementation Technique): The mechanism of passing dependencies into an object via constructor or setter rather than having the object construct them itself using new Database().