News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthew Weier O'Phinney's Blog:
Dependency Injection An analogy
March 22, 2011 @ 12:36:20

For those still grappling with the concept of dependency injection, Matthew Weier O'Phinney has posted an analogy that could help make the concept a bit more clear.

I've been working on a proposal for including service locators and dependency injection containers in Zend Framework 2.0, and one issue I've had is trying to explain the basic concept to developers unfamiliar with the concepts -- or with pre-conceptions that diverge from the use cases I'm proposing.

Using his wife as a sample sounding board, he came up with a restaurant-based analogy to help explain the concept - asking for certain pre-planned things but wanting customizations. He reminds developers that there's not much "magic" to DI. Things are all well defined from the outset and you only have to use it when you want.

0 comments voice your opinion now!
dependency injection analogy restaurant magic configuration


blog comments powered by Disqus

Similar Posts

HowToForge.com: How To Set Up suPHP With PHP4 And PHP5

Brian Swan's Blog: Do Stored Procedures Protect Against SQL Injection?

Padraic Brady's Blog: Zend Framework 2.0: Dependency Injection (Part 1)

Matthew Weir O'Phinney's Blog: Introducing Phly_Struct and Phly_Config

Fabien Potencier's Blog: Do you need a Dependency Injection Container?


Community Events











Don't see your event here?
Let us know!


unittest symfony2 install composer performance overview package podcast introduction facebook framework application opinion hhvm component hack security language release database

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework