File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inversion of control

 
Jim Sera
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic