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

PHPMaster.com:
Managing Class Dependencies Dependency Injection, Service Locators & Factories, Pt 2
June 28, 2012 @ 10:58:15

PHPMaster.com has posted the second part of Alejandro Gervasio's series looking at dependency injection, service locators and factories. In this new part of the series, he picks back up with his look at these patterns and how they can reduce your dependencies on things like "new" even more.

While it's fair to admit that factories do have a neat niche in a number of special use cases, I'm not so merciless as to condemn Service Locators and plain Dependency Injection to an unfair exile. In this final part we'll take a closer look at the implementation of these popular patterns so that you can pick up the one that best suits the need at hand.

He talks some about "class collaborators" as used in service locators and using it in his FileStorage example to find and use pre-created objects. He compares this method with a more simple dependency injection approach, noting that not only is it simpler to maintain but also can cause less overhead required for the DIC.

0 comments voice your opinion now!
class dependencies series dependencyinjection servicelocator


blog comments powered by Disqus

Similar Posts

IBM developerWorks: What's new in PHP V5.3, Part 2: Closures and lambda functions

Nick Halstead's Blog: Programming Tips Series

Sebastian Göttschkes' Blog: Extending the Testclass for Unittests

Matthew Weir O'Phinney's Blog: exuberant ctags with PHP in Vim

Wan Qi Chen: Background jobs with php and resque (Series, Parts 4, 5 & 6)


Community Events











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


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

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