News Feed
Sections




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

DevShed:
An Introduction to Using the Decorator Pattern with PHP
August 28, 2006 @ 11:23:53

In yet another of their looks at using patterns in PHP, DevShed has posted the first part of a new three-part series today covering the Decorator patten, useful for adding new or other functionality to prexisting objects.

Due to the wide range of web applications where the decorator pattern can be successfully applied, over the course of this series, I'll show you some useful pointers to demonstrate how this pattern works, and how it can be introduced in your own PHP applications with only minor hassles. Before you start reading the rest of this article, make sure that you have a pretty good understanding of object-based programming with PHP, since you'll see an abundance of material related to this topic.

To help you get started, they start at ground level with a basic class, one to save a string to a file. They then, in a different class, build the Decorator object, adding the ability to reset and display the string. To help out, they also make two other classes to make the string either all uppercase or all lowercase. Finally, they tie them all together, amking an application that adds its functionality on the fly.

0 comments voice your opinion now!
pattern decorator dynamic functionality tutorial stringsaver pattern decorator dynamic functionality tutorial stringsaver


blog comments powered by Disqus

Similar Posts

Padraic Brady's Blog: Example Zend Framework Blog Application Tutorial: Parts 1-8 Revisited

ProDevTips.com: Ajax, ZF and Smarty feed reader - part 1

Google Cloud Platform Blog: Google App Engine for PHP with PhpStorm

Alexander Netkachev's Blog: Installing Propel object persistence layer for Web application

IBM developerWorks: Understanding the Zend Framework, Part 3: The feeds


Community Events





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


community version interview conference symfony framework voicesoftheelephpant opinion composer library laravel language security series podcast tool introduction release list artisanfiles

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