DependencyInjection
ThoughtStorms Wiki
Context : ProgrammingStuff
When you create a new instance of an object that itself contains other sophisticated components or references other services, you need to specify what those are. But often, these can be one of several flavours.
Dependency injection is the problem of configuring the object. Saying, which of the particular components / services it will use. You need to inject the dependency into your newly created object.
There are three options :
- do it in arguments to a constructor
- have setters and getters for each component.
- have an interface which defines injecting the dependency.
ManageAbility, deconstructing dependency injection : http://www.manageability.org/blog/stuff/deconstructingdependencyinjection
See also :
Backlinks (2 items)