Daily Term: Service Locator
Service Locator
The Service Locator Pattern provides a centralized registry for accessing dependencies, allowing objects to look up services they need. For example, a class might use a service locator to retrieve a logging service by name. Service locators simplify dependency management but can hide dependencies, making code harder to understand and test, and they’re often considered an anti-pattern compared to dependency injection.
Date: 2025-12-01