81.1k views
1 vote
Dependency Inversion Principle [Pro]: (2)

Option 1: High coupling
Option 2: Inversion of control
Option 3: Tight cohesion
Option 4: Monolithic structure

User Helder
by
8.2k points

1 Answer

2 votes

Final answer:

The correct answer to the student's question about the Dependency Inversion Principle is Option 2: Inversion of control, which is used to reduce dependencies in software design.

Step-by-step explanation:

The Dependency Inversion Principle (DIP) is a fundamental concept in object-oriented software design that addresses how to reduce dependencies amongst the components of a system.

When discussing DIP, there are several key concepts to consider, but Option 2: Inversion of control is the correct answer associated with this principle. DIP suggests that high-level modules should not depend on low-level modules; both should depend on abstractions. Inversion of control (IoC) is a technique used to achieve DIP by making high-level modules independent from the low-level module implementation details.

Decoupling is also relevant, as it refers to reducing the interdependencies between components of a system, which is a goal of DIP. Improved decoupling allows for greater flexibility and ease of maintenance, as it minimizes the impact of changes within one component on others.

While not part of DIP, coupling and cohesion are related terms: high coupling implies a high degree of dependency between components, while tight cohesion refers to how closely related the responsibilities of a single component are.

User Jesper Mygind
by
7.9k points