[RESOLVED]Regarding IOC & DI relation ship and the concept like inject dependencies to invert control

i admit that i really confuse between IOC & DI ? what is relation between IOC & DI ? what is container in DI ? what container does ?

How MS Meaf is similar & different than DI concept & usage ?

please discuss about IOC & DI for beginner.

what is the meaning of this line You need to inject dependencies to invert control ?

Anyone can u plzz discuss with small example to explain what you said like
inject dependencies to invert control

thanks

Hi,

IoC is a generic term meaning rather than having the application call the methods in a framework, the framework calls implementations provided by the application.

DI is a form of IoC, where implementations are passed into an object through constructors/setters/service look-ups, which the object will ‘depend’ on in order to behave correctly.

IoC without using DI, for example would be the Template pattern because the implementation can only be changed through sub-classing.

DI Frameworks are designed to make use of DI and can define interfaces (or Annotations in Java) to make it easy to pass in implementations.

IoC Containers are DI frameworks that can work outside of the programming language.  In some you can configure which implementations to use in metadata files (e.g. XML) which are less invasive.  With some you can do IoC that would normally
be impossible like inject implementation at
pointcuts
.

See also

http://martinfowler.com/articles/injection.html#InversionOfControl

Taken from

http://stackoverflow.com/questions/6550700/inversion-of-control-vs-dependency-injection

mou_inn

How MS Meaf is similar & different than DI concept & usage ?

The Managed Extensibility Framework (MEF) is a composition layer for .NET that improves the flexibility, maintainability and testability of large applications. MEF can be used for third-party plugin extensibility, or it can bring the benefits of a
loosely-coupled plugin-like architecture to regular applications. (taken from

http://mef.codeplex.com/).

Grz, Kris.

thanks for answer but it would be great if u discuss all the points with bit of example that may help me like beginner developer lots. thanks

Hi,

the best thing is to simply take a look at a DI container and its documentation and start using it. There are tutorials available on this site that show it:

Grz, Kris.

Leave a Reply