A technique in which an object's dependencies are supplied to it from outside rather than being constructed by the object itself, making code easier to test and to reconfigure since a dependency can be swapped without changing the dependent class.
Facts
Core PrincipleAn object or function receives the other objects or functions it requires rather than creating them internally. 1 Connections
In Field
Invented
Martin Fowler coined and formalized the term dependency injection in his widely cited 2004 article distinguishing it from the broader inversion-of-control principle.
Sources
1. Dependency injection - Wikipedia
Lead paragraphQuote, Lead paragraph
Dependency injection is a programming technique in which an object or function receives other objects or functions that it requires, as opposed to creating them internally.
View the Source Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.
Sign in to dispute this or suggest a correction.