At its core DI is basically constructing instances of objects with the help of other objects.
So you have constructor injection , setter injection , property injection ,etc ...
Now that you got these huge object graphs, you need a way to wire them without pain.
That's where service locators and IOC containers are handy.
A service locator is basically a registery that holds the dependencies and you instanciate objects that way
Comments
At its core DI is basically constructing instances of objects with the help of other objects. So you have constructor injection , setter injection , property injection ,etc ...
Now that you got these huge object graphs, you need a way to wire them without pain.
That's where service locators and IOC containers are handy.
A service locator is basically a registery that holds the dependencies and you instanciate objects that way
then or whateverThe question is while dependency injection is good practice in general , do Pythonists need IOC containers or Service Locators? etc ...
AMD in javascript has nothing to do with dependency injection. AMD is not about instanciating objects but resolving file dependencies.
"At its core DI is basically constructing instances of objects with the help of other objects."
Why would you wan t that in python? Doesn't python have higher order functions?
Exactly, in a dynamic language with first-class functions you don't need to create object factories just to pass around static methods between scopes.