Why Dependency Injection is also called Inverstion of control (IOC) [duplicate]
Possible Duplicate:
Inversion of Control < Dependency Injection
I know what dependency injection is but trying to understand why its also know as Inversion of Control.
Inversion of control is a principle and dependency injection is a technique. The distinction is subtle and most people refer to them interchangeably.
Basically it means that not the components itself are in control for looking up and instantiating their dependencies anymore.
The term Dependency Injection came up in Martin Fowlers great article on Inversion Of Control Containers and the Dependency Injection Pattern:
As a result I think we need a more specific name for this pattern. Inversion of Control is too generic a term, and thus people find it confusing. As a result with a lot of discussion with various IoC advocates we settled on the name Dependency Injection.
精彩评论