BackendGeneral

Dependency Injection

Also written as DI

A technique where an object's dependencies (the other objects or services it needs) are supplied from the outside, rather than the object creating them itself — making code easier to test and swap out.

Think of it like

Like a restaurant kitchen being supplied its ingredients by a delivery service, rather than each cook having to grow their own vegetables.

Junior or senior?

Junior sounds like

Names dependency injection as a buzzword without explaining why it helps.

Senior sounds like

Can describe how it made a specific piece of code easier to test.

Ask them

“How did dependency injection make a piece of code easier to test in something you built?”