Dependency Injection

All

This pattern was originally described in Martin Fowler’s article!!

We can summarized it this way: Object A creation depends on another object properties. Therefore A have a dependecy of B. There are several ways to reduce this problem, and B creation is also possible easily using keyword arguments. I dont know why but they always use the engine/car example.

Interestingly to remark that for python it is debatable a useful pattern actually.  But there are many micro-frameworks and tools for python [5].

Links:

[1]https://en.wikipedia.org/wiki/Dependency_injection

[2]https://martinfowler.com/articles/injection.html

[3]https://github.com/ets-labs/python-dependency-injectorhttps://pypi.python.org/pypi/dependency_injector

[4]http://python-dependency-injector.ets-labs.org/introduction/di_in_python.html

[5] https://pypi.org/project/dependency_injector/

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s