Science Fair Project Encyclopedia
Dependency injection
Dependency injection (DI) is a programming design pattern and architectural model, sometimes also referred to as "inversion of control" or "IoC", although technically speaking dependency injection specifically refers to an implementation of a particular form of IoC. The pattern seeks to establish a level of abstraction via a public interface, and to remove dependency on components by (for example) supplying a plug-in architecture. The architecture unites the components rather than the components linking themselves or being linked together. Dependency injection is a pattern in which responsibility for object creation and object linking is removed from the objects themselves and transferred to a factory. Dependency injection therefore is obviously inverting the control for object creation and linking, and can be seen to be a form of IoC.
There are three common forms of dependency injection: setter, constructor and interface based injection.
Some examples of implementations of dependency injection include the Spring framework for Java, and Ruby on Rails for the Ruby programming language.
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details


