~/talk

The 7 Deadly Sins of Dependency Injection

Talkat PHP UK Conference 2014 · 2014-02-21..02-22· [frontend-architecture]
slides:none on file

Clears specific mistakes: using a service locator or container‑aware objects hides real dependencies, property injection uses reflection and is slow and brittle, and constructors with many args mean bad architecture not DI failure. Gives numbers and history: company converted its framework to DI in 2005 and ran ~200 projects, a Composer search returns 285 packages for DI, and two contributors start container-interop on GitHub. Recommends Constructor injection, interfaces over concrete classes, factories for default wiring, PHP config for speed, and prefers Symfony’s container.

AI-written summary · about

  1. 0:00Start
  2. 3:47The 7 deadly sins
  3. 3:58Lust
  4. 4:19A simple controller...
  5. 5:41Can a Service Locator help?
  6. 8:39Avoid "ContainerAware"
  7. 9:07Establish boundaries
  8. 9:50Greedy controllers...
  9. 11:49Architecture is tool agnostic
  10. 12:33ServiceLocator will not fix it
  11. 12:57Depend on what you need...
  12. 13:30Dependency Inversion
  13. 13:50Depend on abstractions
  14. 14:48Gluttony
  15. 15:13Too many implementations
  16. 16:46No common standard!
  17. 17:00I have a dream
  18. 18:29Sloth
  19. 18:48(Public) Property injection
  20. 20:01(Protected) Property injection
  21. 22:25Constructor injection
  22. 25:37Null checks everywhere!
  23. 26:38Circular dependency hell
  24. 27:06Avoid circular dependencies!
  25. 27:16Interface injection
  26. 28:17Implicit wiring
  27. 29:12Default dependencies?
  28. 30:30Separating the concerns
  29. 32:29Wrath
  30. 32:58DIC vs. SL
  31. 35:31Using a DIC
  32. 36:01Envy
  33. 36:22Types of configuration
  34. 36:49Internal Configuration
  35. 39:34External Configuration
  36. 41:42Both ways make sense...
  37. 42:03pick what makes sense!
  38. 42:51Configuration is too complex?
  39. 44:11Pride
  40. 44:33Choose wisely
  41. 45:38Learn to love it
  42. 46:03Famous final words
  43. 56:31Artwork credits
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.