Software Engineering vocabulary · Architecture, Design Patterns and Graphics

Dependency injection

Meaning in software engineering, with examples

nounAdvanced term

In software engineering, dependency injection means: A technique where an object receives the things it needs, such as a database client, from outside instead of creating them itself, which makes code easier to test.

In Turkish: bağımlılık enjeksiyonu, bağımlılıkların dışarıdan verilmesi

How it is used

Often shortened to DI. Frameworks such as Spring, ASP.NET Core and Angular have built-in DI containers. With dependency injection, tests can pass in a mock instead of the real service. You inject a dependency, often through the constructor.

Example sentences

  1. Thanks to dependency injection, the tests use a fake payment client instead of the real one.

  2. Don't create the logger inside the class; use dependency injection and pass it in.

Common collocations

  • DI container
  • constructor injection
  • inject a dependency
  • use dependency injection

More terms: Architecture, Design Patterns and Graphics

Practise with graded reading

Reading at the right level is the fastest way to make new words stick. Pick free English books by level: