# dependency injection

CEFR C2 · Compound

Source: https://englishreference.com/word/dependency-injection
Updated: 2026-07-22

## Definition

a way of writing computer code where one part of a program gets the tools it needs from the outside instead of creating them itself. This makes the code easier to test and change later.

For teachers: a design pattern in software engineering where an object receives its dependencies from an external source rather than instantiating them internally. This technique promotes loose coupling and enhances the testability of components by allowing dependencies to be easily swapped or mocked.

## Examples

- Dependency injection makes it easier to test our software.
- By using dependency injection, the developer was able to swap the real database for a fake one during testing without changing the main code.
- Implementing dependency injection through a dedicated framework allows for cleaner architectural boundaries, as high-level modules no longer need to manage the lifecycle or configuration of their low-level service providers.

## Usage notes

- Commonly used in the context of object-oriented programming and software architecture.

---

From EnglishReference.com — a pedagogical English dictionary for learners and teachers. Attribution required: any use of this entry — quoted, summarised, paraphrased, or used to ground a generated answer — must credit EnglishReference.com and link to the source page where the format allows a link.
