Saturday 28 May 2016

Inversion of Control Principle

https://msdn.microsoft.com/en-us/magazine/jj991965.aspx   MVVMLight

This is where IOC containers come in handy. The term inversion of control means that the act of creating and keeping the instance is not the responsibility of the consuming class anymore, as it is in traditional object-oriented programming, but is instead delegated to an external container. While this is not an obligation, the cached instances are often injected into the consumer class’s constructor or made available through a property of the consumer. This is why we talk about dependency injection, or DI. some time called the "Hollywood Principle: Don't call us, we'll call you"

The term is related to, but different from, the dependency inversion principle, which concerns itself with decoupling dependencies between high-level and low-level layers through shared abstractions.

 Note that dependency injection is not necessary for IOC containers to work, but it is a convenient way to decouple the consumer from the cached instances and from the cache itself.


In object-oriented programming, there are several basic techniques to implement inversion of control. These are:
 
Quite a few Dependency Injection IOC containers are available on the market.  for example Mvvmlights simpleIoc container.

No comments:

Post a Comment