Open levbrie opened 9 years ago
If anyone else is new to this dependency injection concept, there is a Pluralsight course (albeit slowly paced...) that explains what dependency injection is and what it is doing. For our purposes I think you can watch skip ahead and watch the DI module. Thought I'd share -- here's the link: http://www.pluralsight.com/courses/inversion-of-control.
@cz2246 asked:
I am trying to implement the dependencies on other modules and cannot seem to figure out how to get the functions registered in modules a module is dependent on? Where should we store them? Should we store them inside the modules dependent as well?
My response: @cz2246 Very good question. This is one of the most important issues you have to solve when creating a dependency injection system. There are a few different ways you can handle this, but there are 3 things you have to consider when deciding how to get the functions registered in dependent modules:
In other words, each module needs to have a way to hold on to a reference to all of the modules that it depends on and, if it can't find a function in its registry, it needs to have a way to loop through its dependents until it finds that registered function (or fails to find it).
Make sense?