The inverse of IoC is Control
comoyo.github.com
The inverse of IoC is Control
1–10 of 66 posts
Re: The inverse of IoC is Control
#2Examples (c#) * Autofac * Ninject
Re: The inverse of IoC is Control
#3Younger IoC frameworks aim for configuration in code, allowing for a much more dynamic usage. Examples (c#) * Autofac * Ninject
I agree with a lot of what he writes. At the same time I believe there are cases where I would appreciate some kind of automation for wiring (f.ex. if I want a fresh instance for each session or request). And there are certainly cases when runtime wiring - as in the mentioned case of plugins - is useful.
Re: The inverse of IoC is Control
#4I guess it's super-obvious from context (and the claim of the title) so I guess I'm just not very smart, today. Oops.
Re: The inverse of IoC is Control
#5That's where the DI part comes from -- to enable us to load a different dependency based on the customer. Now, you could provide a different bootstrapper class per customer or start building a mega class with a lot of ifs-and-buts(elses), or you specify this kind of stuff in a configuration file.
We opt for configuration files. We opt for IDEs that can interpret Spring configuration files which means typos or incorrect dependencies do show up. This allows us to swap out implementations in case shit goes down without having to recompile, connect over a VPN to a remote desktop and hop through a few more hoops to get our class file on the other side. If you're not running your own apps on infrastructure you control (we should be so lucky), you have to take this sort of stuff into account. I'd love to be able to say "This is how stuff's set up. Deal with it."
(And when shit goes down, it is usually not at the place you were expecting it to happen, which means all kinds of configuration options for your bootstrapper would probably still fall short.)
Re: The inverse of IoC is Control
#6Re: The inverse of IoC is Control
#7 > In the Java community there's been a rush of lightweight
> containers that help to assemble components from
> different projects into a cohesive application.
> Underlying these containers is a common pattern to how
> they perform the wiring, a concept they refer under the
> very generic name of "Inversion of Control". In this
> article I dig into how this pattern works... and
> contrast it with the Service Locator alternative. The
> choice between them is less important than the principle
> of separating configuration from use.
[1] http://martinfowler.com/articles/injection.html(edit: Also, the Spring Framework has had alternatives to XML configuration for years: http://www.ibm.com/developerworks/webservices/library/ws-spr...)
Re: The inverse of IoC is Control
#8Don't use IoC if you don't need it, but I'll explain why we need it in our case: some customers require different implementations. That's where the DI part comes from -- to enable us to load a different dependency based on the customer. Now, you could provide a different bootstrapper class per customer or start building a mega class with a lot of ifs-and-buts(elses), or you specify this kind of stuff in a configurati…
Guice is a nice IoC framework, but look at what they say on their website:
"Think of Guice's @Inject as the new new."
Re: The inverse of IoC is Control
#9Things like callbacks, observers, events, ... are also types of IoC.
Re: The inverse of IoC is Control
#10Younger IoC frameworks aim for configuration in code, allowing for a much more dynamic usage. Examples (c#) * Autofac * Ninject
We use Guice which also allows that. But that doesn't address some of the key points he makes, such as - runtime x compile time wiring - wiring is based on types so injecting differently set up instances is difficult (we have a hell of Providers and different annotations to pick the right kind of instance injected) - non-transparency of the wiring process (sice it is performed by the magical IoC container) I agree wi…