Is overriding dependency prodivers considered bad practice?

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Sun Feb 24 11:37:49 UTC 2019


On Sunday, 24 February 2019 at 10:36:40 UTC, Victor Porton wrote:
> From https://stackoverflow.com/q/54847333/856090 :
>
> I am reimplementing something like Python [Dependency 
> Injector][1] in D programming language. I want to build a pure 
> dependency injection framework for D.
>
> Is [overriding of providers][2] considered bad practice? It 
> seems that overriding of providers is clearly a nonlocal 
> dependency and nonlocal dependencies are usually considered a 
> bad practice by OOP theoretics.
>
> So should I or should I not implement overriding of providers 
> in my pure dependency injection framework for D?
>
>   [1]: http://python-dependency-injector.ets-labs.org/
>   [2]: 
> http://python-dependency-injector.ets-labs.org/providers/overriding.html

Just wondering, did you check existing implementations of 
dependency injection frameworks, such as 
https://code.dlang.org/packages/aedi or 
https://code.dlang.org/packages/poodinis before trying to 
implement yet another one?
If you did check them, I'm wondering, what deficiencies in those 
implementations you found that made you to attempt to create yet 
another DI framework?

Dlang also has a page with a list of existing DIs 
https://wiki.dlang.org/Dependency_Injection_Containers.

Thank you,
Alexandru.


More information about the Digitalmars-d mailing list