Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IoC, AOP and more

What is an IoC container?

What is an IoC/DI framework?

Why do we need a framework for IoC/DI?

Is there any relationship between IoC/DI and AOP?

What is Spring.net/ninject with respect to IoC and AOP?

like image 804
user366312 Avatar asked Jun 03 '09 17:06

user366312


People also ask

What is IoC and AOP?

Objective of Spring IOC is to reduce explicit dependencies between components, while purpose of Spring AOP is to wire components together possibly by enforcing certain common behavior (read: NOT Interface)

What are the different types of IoC?

There are basically two types of IOC Containers in Spring: BeanFactory: BeanFactory is like a factory class that contains a collection of beans. It instantiates the bean whenever asked for by clients. ApplicationContext: The ApplicationContext interface is built on top of the BeanFactory interface.

What is AOP in dependency injection?

Dependency Injection helps you decouple your application objects from each other and AOP helps you decouple cross-cutting concerns from the objects that they affect. AOP is like triggers in programming languages such as Perl, . NET, Java, and others. Spring AOP module provides interceptors to intercept an application.

Is DI and IoC both are same?

Dependency Injection is the method of providing the dependencies and Inversion of Control is the end result of Dependency Injection. IoC is a design principle where the control flow of the program is inverted. Dependency Injection is one of the subtypes of the IOC principle.


1 Answers

JMSA,

James Kovacs wrote a fantastic article which covers many of your questions I would recommend reading it Here

Spring.Net, Ninject, Unity, Castle Windsor, Autofac are all IOC containers which are configurable in different ways, many of them do also support AOP.

Frameworks for IOC/DI are useful because they provide standard mechanisms, for example if you are hiring a new developer it is much easier to say, we use this framework and pass them the links to the tutorials / help guide. At the same time these frameworks are tried and tested by a large community / companies.

Let me know if any of your questions remain unanswered after reading the article and the above answes and I'll do my best to provide further assistance.

like image 186
Peter Avatar answered Nov 16 '22 20:11

Peter