News Feed
Sections




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

Giorgio Sironi's Blog:
Never write the same code twice Dependency Injection
July 29, 2009 @ 10:27:12

In a new post to his blog Giorgio Sironi looks at how using dependency injection in your applications can help keep you from writing the same code over and over:

Is Dependency Injection difficult? Is it hard to do? Certainly it provides value. Particularly in Php, but also in other object-oriented languages, Dependency Injection gives steroids to the process of class reuse, designing components as loosely coupled objects.

He explains a bit of what dependency injection is all about, how it fits in with unit testing applications and a few examples of how it might look in some sample PHP classes. He shows how a bit of refactoring can remove dependence of one class on another and how the factory pattern can be used to correctly create an instance your first class might need.

0 comments voice your opinion now!
dependency injection duplicate code tutorial


blog comments powered by Disqus

Similar Posts

PHP-GTK Community Site: GtkToolbar, GtkMenubar, and PEAR XML-RPC for geo-nick

HowTo Forge: Installing Lighttpd With PHP5 And MySQL Support On Fedora 7

Fabien Potencier's Blog: Tweeting from PHP

ITNewb.com: Building a Spam Free Contact Form without Captchas

Till Klampaeckel's Blog: Cooking PHPUnit (and a chef-solo example on top)


Community Events





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


mvc introduction series framework opinion composer version voicesoftheelephpant release security podcast interview language package update tool laravel community library symfony

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