Elsevier interview question

Q: What is dependency Injection

Interview Answer

Anonymous

Jul 26, 2016

Dependency Injection(DI) is series of software design practices that help us develop loosely coupled code. DI is the means to the end goal which is loosely coupled code. When our code is loosely coupled it means that our classes are minimally impacted by changes made in other collaborating classes. There is limited direct knowledge of the internal workings between classes. DI helps us achieve loose coupling through infrastructure that provides our class with the dependencies that is requires. We are less likely to get in trouble because DI tells our class which collaborating class it will use.