Types
Martin Fowler identifies three ways in which an object can get a reference to an external module, according to the pattern used to provide the dependency:
- Type 1 or interface injection, in which the exported module provides an interface that its users must implement in order to get the dependencies at runtime.
- Type 2 or setter injection, in which the dependent module exposes a setter method that the framework uses to inject the dependency.
- Type 3 or constructor injection, in which the dependencies are provided through the class constructor.
It is possible for other frameworks to have other types of injection, beyond those presented above.
Read more about this topic: Dependency Injection
Famous quotes containing the word types:
“The bourgeoisie loves so-called positive types and novels with happy endings since they lull one into thinking that it is fine to simultaneously acquire capital and maintain ones innocence, to be a beast and still be happy.”
—Anton Pavlovich Chekhov (18601904)
“The rank and file have let their servants become their masters and dictators.... Provision should be made in all union constitutions for the recall of leaders. Big salaries should not be paid. Career hunters should be driven out, as well as leaders who use labor for political ends. These types are menaces to the advancement of labor.”
—Mother Jones (18301930)
“The American man is a very simple and cheap mechanism. The American woman I find a complicated and expensive one. Contrasts of feminine types are possible. I am not absolutely sure that there is more than one American man.”
—Henry Brooks Adams (18381918)