News Feed
Sections




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

Coders' View Blog:
The Strategy Pattern Using PHP
May 29, 2009 @ 11:14:02

On the Coders' View blog there's a recent post looking at using the strategy design pattern in your PHP application.

In the strategy pattern, algorithms are extracted from complex classes so they can be replaced easily. For example, the strategy pattern is an option if you want to change the way pages are ranked in a search engine. Think about a search engine in several parts - one that iterates through the pages, one that ranks each page, and another that orders the results based on the rank.

Their example shows a class that, based on a few different search "strategies", can locate user information in the user listing. Their example uses a random and a "find after" strategy and includes the results.

4 comments voice your opinion now!
tutorial designpattern strategy


blog comments powered by Disqus

Similar Posts

NETTUTS.com: Introduction to the Smarty Templating Framework

Label Media Blog: Design Patterns in PHP - Decorator Pattern

DevShed: Performing Basic Tasks with MySQL 4.1 and Above, using mysqli with PHP 5

Rob Allen's Blog: MongoDB on OS X with the stock PHP installation

PHPBuilder.com: Securing Data Sent Via GET Requests


Community Events

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


install community extension podcast release opinion unittest language library api example laravel php7 laravel5 series framework interview xdebug voicesoftheelephpant introduction

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