qp

About dependency injection

This past week I went to the .NET meetup and saw several presentations. The first one was on dependency injection. Following the meetup I googled on the topic and found this helpful StackOverflow thread.

Extract from the second top answer:
**quote**
This gives you a ton of advantages. Two important ones are the ability to control functionality from a central place (the Main() function) instead of spreading it throughout your program, and the ability to more easily test each class in isolation (because you can pass mocks or other faked objects into its constructor instead of a real value).

The drawback, of course, is that you now have one mega-function that knows about all the classes used by your program. That's what DI frameworks can help with. But if you're having trouble understanding why this approach is valuable, I'd recommend starting with manual dependency injection first, so you can better appreciate what the various frameworks out there can do for you.
**unquote**

This linked article from the thread, Dependency Injection Demystified, also delivered on what it promised.

Wow it's been long since I last posted.
Permalink | Posted 10:11PM 3-2-2015 by Quentin.

Comments

There are no comments.



Don't fill this in!