What problems do dependency injection solve for you? I haven't had a chance to use it yet, and I've always been curious about its benefits in real projects.
Everytime you pass arguments to a constructor or a method,if the parameter is itself an object you will call a method on (message passing), you are doing dependency injection.
So it's a fancy word for a basic idea.
The OP is talking about an IoC container or a service locator. which is a tool that will wire up and build objects on demand according to a definition. The alternative is writing factories( ex : document.createElement("DIV") is a factory method ).
So it's a fancy word for a basic idea.
The OP is talking about an IoC container or a service locator. which is a tool that will wire up and build objects on demand according to a definition. The alternative is writing factories( ex : document.createElement("DIV") is a factory method ).