ELI5: Explain Like I'm 5

Dependency Injection

Dependency injection is like a game. Imagine that you have a toy robot, and it needs energy to work. The energy comes from batteries, which you have to change every now and then so your robot can keep running.

With dependency injection, you can make sure that the robot always has new batteries on hand. You create a box, and fill it with spare batteries. Then, you connect the box to the robot so that it can reach the batteries whenever it needs them.

Now whenever the robot needs batteries, it can just reach into the box and get whatever's inside. You don't have to worry about taking out the old ones and putting in new ones. The robot just reaches into the box to get the energy it needs!