Visual Studio / .NET Framework

TH13 End-to-End Dependency Injection & Writing Testable Software


11:00am - 12:15pm

Level: Intermediate

Miguel Castro

Miguel Castro



Melvicorp LLC

Dependency Injection is one of those terms that advanced programmers throw out with an expectation and assumption of full understanding on the part of the receiver. However, I constantly get asked by attendees, students, and clients to please recommend a good DI product and show them how to use it; and when I proceed to start talking about the subject, it becomes immediately apparent that many don't even know what they're asking about. It's easy to get infatuated by a cool buzz phrase, especially when you hear so many others using it. But to truly understand something you need to start by understanding the problem spaces that it is trying to solve. It’s important to learn the concepts behind DI so you can write software that can be properly tested. So let's bring you totally up to speed then.

In this session, I'll explain dependency injection from concept to implementation, and use raw code samples to show you how it works and what problems it solves. I’ll demonstrate how writing abstracted code can help you test your applications much better, whether or not use a DI container. Then I'll get into what a DI container is and some of the characteristics and features it offers. I’ll finish by showing you implementation examples in three different platforms.

You will learn:

  • How to use DI for everything
  • How to completely eliminate class instantiation
  • Ensure across-the-board testability