SlideShare a Scribd company logo
Dependency Injection And IOC ContainersTim MurphyTechnical Specialist - PSC Group, LLC
The Pursuit of the Loosely Coupled System
Traditional Object StructureDatabase Access ServiceEntityDatabase Access Service
 Service Proxy
Logging Service
Etc..Service ProxyLogging ServiceTightly coupled services!
 Doesn’t promote reusability
Creates brittle systems
Difficult to “mock” makes testing difficultWith Dependency Injection
The End(or is it)
Better….… but still a lot of workThere are so many dependencies in this system, how do I manage them all?
Dependency InjectionWith a Factory PatternEntity“I need to be created, including have all my services crated and given to me.”Object Factory “ I know how to build all of this stuff.”Create aConcrete instanceCreate anEntity for meInstance forapplicationApplication“I need an Entity, but I don’t know how to create it.”
I want to spend my day writing functional business code, NOT a bunch of plumbing code…
Dependency Injection Frameworks to the Rescue!Structure MapNinjectWindsor Microsoft Unity
With a Dependency Injection/ IOC FrameworkEntityDatabase Access Service
 Service Proxy

More Related Content

Dependency Injection And Ioc Containers