File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Inversion of control Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Inversion of control" Watch "Inversion of control" New topic
Author

Inversion of control

Jim Sera
Greenhorn

Joined: Jul 28, 2005
Posts: 11
I have seen references to this term but I can't seem to understand what it actually means. Can someone in very simple terms explain what this is? Also, is the term "dependency injection" the same thing? What exactly do they mean by dependency injection? What is the use of performing such an operation?

I guess I'm reading all these things about the Spring framework but can't really figure out why it is so useful and what it really accomplishes over the traditional approach. Thanks much
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

Both IoC and DI mean the same. DI means that depenedencies are injected into the code by the container (Spring , Pico, Hivemind) without you having to do that. For example your code may be having dependecy on Datasource. You will need to write the lookup code using JNDI. Let us say that you need to port you code to non -JNDI environment then you will have to replace the JNDI lookup code. If you specify this in a XML as Spring does you can change the XML file to reflect the new environment without having to change code. Advantages are it becomes easier to test different implementation just by changing the XML file, code does not manage the dependencies and reduced coupling between components. I am quite new to DI and never worked on Spring or any DI containers. I feel that there is too much hype surrounding DI.

Here is good article
http://www.theserverside.com/articles/article.tss?l=IOCBeginners


Groovy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inversion of control
 
Similar Threads
Problems in large-scale IT projects
is there a way to simulate closure in java
Inversion of control
* Welcome Dhanji Prasanna
difference between Dependency Injection (DI) & Inversion of Control (IOC)