Human figures live their lives in a surreal dystopian world, until they find a hole leading to an even stranger one.
Video was made with React Remotion which was pretty cool. If anything, check that out.
When an object requires other objects for its work, pass references to those other objects into its __init__ method. That’s it.
Consistently applied, all construction gets pushed to the entry-point of the program. Congratulations, you've just discovered the so-called "composition root".
Now that all construction is taking place at once, the order matters as you can't pass a dependency to its dependent until the dependency has been constructed. But it may have its own dependencies. So now there is a topological sorting problem.
Turns out computers are really good at topological sorting. So, someone made the computer do it, and we call that a dependency injection container. Tada.
Dead Comment