Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dependency Injection for beginners

David Frame
February 04, 2016

Dependency Injection for beginners

Slides for my talk at the 16th PHP Belfast Meet-up.

David Frame

February 04, 2016
Tweet

More Decks by David Frame

Other Decks in Technology

Transcript

  1. ?

  2. Scenario #1 We need to be able to test our

    order class without sending any emails!
  3. Single Responsibility Principle a class should have only a single

    responsibility Open / Closed Principle “software entities … should be open for extension, but closed for modification.” Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle one should “Depend upon Abstractions. Do not depend upon concretions.”
  4. Scenario #2 We need to store emails in the database

    so they can be queued up and sent at a later date!