2 ms·
For a bit of historical context, during this period the Java ecosystem was very heavily into the Service Locator (https://en.wikipedia.org/wiki/Service_locator_
by oniony 3y ago
For a bit of historical context, during this period the Java ecosystem was very heavily into the Service Locator (https://en.wikipedia.org/wiki/Service_locator_pattern https://en.wikipedia.org/wiki/Service_locator_pattern) pattern. This meant that your classes would look up their dependencies from the registry at runtime as they needed them, quite often resulting in a runtime error at an indeterminate point if a programmatic error had been made.
This also created a bit of a spaghetti nightmare, where it was very hard to reason about which classes (services) were being used by what other services. The Inversion of Control article (later renamed/aliased Dependency Injection) was a reaction to this: it inverted the control away from the using site to the code creating the services.
(I appreciate the article does talk about Service Locator, but I think it's worthwhile having an understanding of the normalities of the time when reading it.)
- nsonha 3y agoI don't understand what it does in an inversion of control article, because it's just the opposite of IoC. Further more, instead of trying to actually manage your dependencies by giving components the signatures that document the exact things they need, you just gonna give them a "locator" that depends on everything under the sun? How is that dependency "management" or any sort of "pattern"?