News Feed
Sections




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

DevShed:
Introducing the Composite Pattern in PHP 5
March 09, 2007 @ 09:33:00

Continuing their look at design patterns, DevShed has kicked off yet another series today spotlighting the Composite pattern as used in PHP5.

The composite pattern is one of the less commonly used patterns in PHP 5. Nevertheless, in certain situations, it is very helpful. This article, the first one in a two-part series, will introduce you to the basic concepts of the composite pattern.

The composite pattern allows you to define a single or multiple objects that will have identical behavior - basically behaving the same if there's just one or with the multiple instances. They start with the basics, reaching for one of their standard examples - a file information reader - to illustrate their point. They create the two helper classes it needs to work, one for the single file read and another for the multiple file read. The finish by combining them all together for a file-reading fiesta, showing how to get a one shot info dose as well adding files to the list and grabbing their info all together.

0 comments voice your opinion now!
introduction tutorial php5 designpattern composite object single multiple introduction tutorial php5 designpattern composite object single multiple


blog comments powered by Disqus

Similar Posts

Programming Facts Blog: Upload large(Big) files in PHP using .htaccess

SitePoint PHP Blog: IronMQ and Laravel: Delays and Retries

DZone.com: CakePHP - Web Test Cases with SimpleTest

TutToaster.com: How To Use, Style and Implement Wordpress Shortcodes

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


Community Events

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


application example laravel configure opinion symfony2 podcast language framework voicesoftheelephpant series interview php7 conference introduction part2 api community performance release

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