What is Dependency Injection

added by ankygoyal
6/15/2012 4:42:34 AM

-1 Kicks, 83 Views

This post gives a brief introduction to the concept of dependency injection


2 comments

dpeterson
6/18/2012 12:49:01 PM
Umm, what good is dependency injection if you specify that the argument to the constructor is a Mercedes rather than just a Car? That's a compile-time dependency you've just put on the Mercedes class, and seems to be the opposite of what you want when trying to do dependency injection.

ankygoyal
6/18/2012 12:59:05 PM
Yes you are right its compile time. In practical applications, its done through config files. But the example shown was to just give an example how dependency can be injected and a simplest possible example is that. :)