News Feed
Sections




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

Zend Developer Zone:
Decorating with External Data
September 27, 2006 @ 08:50:00

On the Zend Developer Zone today, there's this new tutorial that looks at making the move from PHP4's object-oriented programming up to the "more complete obejct model of PHP5" - specifically with the Decorator design pattern.

While working on a project I realized one particular solution was a pretty good way to demonstrate the decorator design pattern together with some of PHP5's features, including abstract classes, interfaces, type hinting, the final keyword and the visibility of properties and methods. This article is intended for those of you who, like myself, are moving from object-oriented programming, including some use of design patterns, in PHP4, to the more complete object model of PHP5.

He sets up a scenario about the development of an online pizza ordering system to show how to "decorate" a pizza with each of the toppings on a list (instead of having to list out every pizza in every possible topping combination). Of course, all of the code is included and explained so you understand exactly what's happening. Finally, there's a demonstration of its usage - a simple call that grabs the stock level/name/cost of each of the items in stock (pizza combinations).

0 comments voice your opinion now!
decorator pattern pizza object oriented combination decorator pattern pizza object oriented combination


blog comments powered by Disqus

Similar Posts

International PHP Magazine: Poll Question: The Biggest Advantage of PHP 5 is?

David Otton's Blog: Neat PHP Tricks: How To Assign References to Globals

DevShed: Utilizing the LIMIT Clause with the Active Record Pattern

Stefan Mischook's Blog: Why learn OOP in PHP - another take

Jason Gilmore's Blog: How I Learned to Stop Worrying and Love Zend_Form


Community Events





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


release symfony tips introduction framework api community threedevsandamaybe voicesoftheelephpant interview list deployment conference language bugfix series code laravel zendserver podcast

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