What is dependency injection?

What is dependency injection?

Approach: Explain providing objects an object needs rather than creating them inside.

A technique where an object receives its dependencies from an external source rather than creating them itself, promoting decoupling.

Follow-up: How does it help with unit testing?

Key concepts: inversion of control, decoupling, unit testing.