jargon

Design patterns·Wiring: injection, containers and lifetimes

the class asks a global object for what it needs mid-method, so its dependencies are invisible until it runs.

Service locator

Also calledlocator, service registry lookup

A registry that components query for their collaborators, rather than being handed them. It solves the same problem as injection and loses on the point that matters: a constructor tells you what a class needs, and a locator call buried in a method does not, so missing registrations become runtime failures and tests need the whole registry stood up. It survives in places where injection is impractical — plugin loading, some legacy frameworks — and the honest position is that it is a fallback, not an equal.

Commonly confused with