Many people in the .NET space picked up Castle Windsor and put it into their projects, and last year I struggled to figure out why IoC containers seem to be considered a common “best practice”? I read a lot of theses and brief explanations about why Windsor and the like, but each last one is really abstract and does not seem practical for most of the projects that I touched on, but recently I have been faced with a lot of projects that use Windsor, and I do not understand why .
C # /. NET essentially supports interface-based coding, abstract objects, delegates, and events. You can implement IoC directly from the main language and, using Reflection, etc., Create instances of unknown instances that implement well-known interfaces without resorting to IoC container libraries.
Using YAGNI / AYGNI (do you need this?), I feel that Windsor has been overused. Of course, I see the benefits of the IoC container, but I feel that these benefits come from additional dependencies and metadata (specific attributes and methods of the IoC container, called in the main code, .config files scattered everywhere, app.config / web. config are filled with anchor tags that make editing a .config file more difficult, etc.), so I'm trying to figure out a compromise.
However, I agree that I make ALL of these observations / statements of ignorance, since I was never involved in a project that used Windsor or another IoC container library. I really need someone to demonstrate a “medium” or “typical” project that used the IoC container library and why this should be “best practice” when it seems to me that it makes an otherwise clean project dirty with dependencies and metadata.
If anyone knows any blog posts, articles or books that will fill me up, it will be awesome.
(I don’t argue, because I really want to get an education on whether I should study on IoC containers).