Service locator pattern

(Learn how and when to remove this message)
Design pattern in software development


The service locator pattern is a design pattern used in software development to encapsulate the processes involved in obtaining a service with a strong abstraction layer. This pattern uses a central registry known as the "service locator", which on request returns the information necessary to perform a certain task.[1] Proponents of the pattern say the approach simplifies component-based applications where all dependencies are cleanly listed at the beginning of the whole application design, consequently making traditional dependency injection a more complex way of connecting objects. Critics of the pattern argue that it is an anti-pattern which obscures dependencies and makes software harder to test.[2][better source needed]

Advantages

Disadvantages

See also

References

  1. ^ Fowler, Martin. "Inversion of Control Containers and the Dependency Injection pattern".
  2. ^ Seemann, Mark. "Service Locator is an Anti-Pattern". blog.ploeh.dk. Retrieved 2017-06-01.

External links

  • v
  • t
  • e
Software design patterns
Gang of Four
patterns
Creational
  • Abstract factory
  • Builder
  • Factory method
  • Prototype
  • Singleton
Structural
Behavioral
Concurrency
patterns
Architectural
patterns
Other
patterns
Books
People
Communities
See also


Stub icon

This software-engineering-related article is a stub. You can help Wikipedia by expanding it.

  • v
  • t
  • e