Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Inversion of control

Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic