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();
$locator->get('app')->run();
Dependency Injection (and Dependency Injection Container): Injecting objects within objects, allowing faster access to these regardless of the factory pattern. And DI Container?
Here is my understanding of it:
$app = new System\Application(System\Config::load());
Inversion of Control: Don't understand this Design Pattern (or understand but don't know if what I do is IoC)
Then, in theory (preferably with simple examples), what does each of these concepts mean? Am I correct, or what is wrong / can be improved?
Thanks!