Explain it in 60 seconds
Service locator as an anti-pattern
Backend Engineering · OOP and Design Patterns · Experienced
What is the service locator pattern, and why is it often considered an anti-pattern?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Global registry; classes fetch dependencies themselves.
- Hides dependencies.
- Runtime failures if not registered.
- Harder testing.
- Prefer constructor injection.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.