Commonly Compared
Service Locator
vs
Review of Service Locator powered by the Slant community.
This pattern uses a central registry known as the "service locator", which on request returns the information necessary to perform a certain task.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Applications can optimize themselves on run-time
By selecting which items are in the service locator, applications can optimize themselves during run-time.
Cons
Con Hides class' dependencies, causing run-time errors instead of compile-time errors
Service Locator hides the class' dependencies, causing run-time errors instead of compile-time errors when dependencies are missing.
Con Very easy to use it incorrectly by coupling nearly all code with it
The wrong approach to Service Locator introduces an unnecessary dependency between the class and the container. It conceals what the dependencies really are as you have to check through the detail of the code to figure out what’s being resolved.
Commonly Compared
Service Locator
vs