Sorin Damian - Using and Abusing Dependency Injection Containers

450 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
450
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Sorin Damian - Using and Abusing Dependency Injection Containers

  1. 1. Using and AbusingDependency InjectionContainersSorin DamianSC RomSoft SRL (rms.ro)[10th of November 2012]
  2. 2. Why do YOU use it?
  3. 3. UGLY DEMO
  4. 4. The Inversion of Control PrincipleDon’t ask for informationAsk for help
  5. 5. IoC – Don’t call us, we’ll call you
  6. 6. IoC for 5 year oldsWhen you go and get things out of the refrigerator for yourself, you can cause problems. You might leave the door open, you might get something Mommy or Daddy doesnt want you to have. You might even be looking for something we dont even have or which has expired.What you should be doing is stating a need, "I need something to drink with lunch," and then we will make sure you have something when you sit down to eat. http://stackoverflow.com/questions/1638919/how-to-explain-dependency-injection-to-a-5-year-old
  7. 7. NICER BUT STILLUGLY DEMO
  8. 8. Dependency InjectionDesign patternThe Inversion of Control principle applied to dependency management Ask for dependencies Instantiating them is a separate concern
  9. 9. What you get+ decupling+ reusability+ testability- more code- more ceremony- composition hell
  10. 10. DEMO(15 lines container)
  11. 11. DEMO(using the container)
  12. 12. If it looks like a factory..And it works like a factory..
  13. 13. Call the container only atthe composition root!
  14. 14. Every time you call the container toget your dependencies a kitten dies..
  15. 15. Any questions?
  16. 16. Thank you!
  17. 17. Diamond SponsorsPlatinum Sponsors Gold SponsorsTraining Partners Media Partners Other Partners

×