Wednesday, September 24, 2014

Musings on DI / IoC containers

I stepped on the holy war of all holy wars, choice of DI :D

I believe we don't need too much documentation on DI, it's the most well-defined component in our field of industry. The list of feature a DI provides is very narrow/well-defined and straightforward, the amount of documentation we need on a DI doesn't need to be book/encyclopedia-like. A cheat sheet would do

So I would hazard a guess, given that DI's functionality is straightforward, any amount of documentation on specific brand of DI would be good enough

On the flip side of the coin, I'm even wary of something if it has many google results/documentation, if most of those documentations/blogs are just troubleshooting or work-around on shortcoming of an specific brand of component

Documentations on DIs are overrated, DI is like the notepad/mspaint of frameworks :-) They just have few functionality, they need little to no documentation, I can live by with a cheat sheet; if there is none, we will create one, even the IDE's autocomplete could be enough. The DI itself is overrated

I'll explore DryIoc from its documentation and see if I'll hit a wall using it on ASP.NET Web API

DryIoc is the simplest of the bunch of other DIs. The author even let the DryIoc be downloaded in source code form from Nuget (of course we can also download the DLL one from Nuget). That's a testament how the author is confident of how simple DryIoc is

Otherwise, there's a second or third fastest and has a good documentation:

DryIoc, LightInject and SimpleInjector offer a very performance combined with support for advanced scenarios like interception and generic decorators.
Simple Injector and LightInject also provide extensive documentation and support all important platforms. -- Daniel Palme

If the documentation is not good enough, we will go with Funq or even Unity, I'm very familiar with Funq :P Rest assured, it's easy to familiarize ourselves on *ALL* DIs, they almost look the same, tried Castle, Ninject, Funq, Unity. DI is the most uncomplicated framework among all frameworks. When you already know one, it's easy to get a headstart on another one

Heheh if there's only a DI for a DI, we can easily plug other faster/well-documented DI if the existing DI is not up to par with our needs, documentation-wise, functionality-wise and performance-wise. Oh.. I think I'm having a dependency Inception on this one O_o

Happy Coding!

No comments:

Post a Comment