Service Locator, Dependency Injection (and Container) and Inversion of Control
I've been programming for some time but never got interested in knowing in theory what each concept means, I may be using a variety of programming concepts, but without knowing it. Service Locator : For me, refers to a record of shortcuts to speed up development by reducing the amount of code. One question is: may Locator refer to namespaces/classes only, or I can have a registry of variables? Here is my understanding of it: $locator = new ServiceLocator() $locator->set('app', new System\Application()); $locator->set('db', new System\Pdo()); // Get the objects $locator->get('db')->connect();