Are dependency injection frameworks used just for testing or is it used in production code? Seems once you start using a framework like ninject, you would not want to reverse everything out. Also, is there a performance hit to using something like ninject?
Are dependency injection frameworks used just for testing or is it used in production
Share
Dependency Injection is an architecture pattern, not a testing one. So it is intended to be used when building production code. In fact, a really good framework introduces really tiny overhead if any. Can’t say for sure if ninject or unity are like so, I used to implement my own.
Possible real downsides of DI are mostly around coding process, not production performance. One that should be probably mentioned: when using DI you lose an ability to walk through the code with ‘Go to Definition’ – it always brings you to interface which is pretty logical but still unusable.