Dependency Injection
/dɪˈpɛndənsi ɪnˈdʒɛkʃən/de·pend·en·cy in·jec·tionnoun
Definition
1.[in software architecture] the practice of supplying a component's collaborators from outside rather than letting it construct them, so the component can be reconfigured or tested without being modified.
Dependency injection let us swap the live payment gateway for a stub in every test.
Etymology
Named by Martin Fowler in 2004, who coined the term to replace the broader 'inversion of control' when describing this specific pattern. Injection carries the medical sense of introducing something from outside, from Latin inicere 'to throw in'.
Synonyms
- inversion of controlsense 1 · Near
Antonyms
- hard-coded constructionsense 1 · Relational