Dependency Injection Pattern
The Dependency Injection Pattern, is described in [http://www.martinfowler.com/articles/injection.html Martin Fowler's article]. It is closely related to the DependencyInversionPrinciple and the so called Inversion of Control (IoC) containers.
IoC is aimed at loosening the coupling of application components. The key concepts are:
- Components do not know each other directly.
- Components specify external dependencies using some kind of a key.
- Some "superior instance" (the IoC container, for example) resolves the dependencies once for each component and hereby "wires" the components together.
It is quite a challenge to implement an IoC container for statically typed languages. In python, however, the core concepts can be implemented quite easily. [http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413268 DependencyInjectionThePythonWay] describes how.