Tag Archives: php5
The Chain-of-Command Pattern: OOP Techniques in PHP
Posted on 10. Mar, 2009 by Will Fitch.
The chain-of-command pattern, like most others, assists with maintaining a loose coupling within your classes. By providing a series of classes that implement the ICommand interface and do a specific bit of processing, the developer doesn’t have to care which method to execute.
Continue Reading
The Observer Pattern: OOP Techniques in PHP
Posted on 09. Mar, 2009 by Will Fitch.
The observer pattern provides another way to maintain loose coupling within your code. It’s an extremely simple pattern and is implemented similarly across languages. There are two parts: the observer and the observable object. Let’s address them both starting with the observer.
Continue Reading
The Iterator Pattern: OOP Techniques in PHP
Posted on 04. Mar, 2009 by Will Fitch.
The iterator pattern is one of the most useful, yet unused patterns defined. It provides a way for class users to count and iterate over a set of objects related to the class. This is very useful in MVC (Model-View-Controller) models as they handle data and the logic that pertains to it.
Continue Reading
The Factory Pattern: OOP Techniques in PHP
Posted on 02. Mar, 2009 by Will Fitch.
The purpose of the factory pattern is to assist with maintaining loose coupling. Code that is tightly coupled is error prone in that if a class is changed, it can have a domino affect to other scripts using it. This is typical to large-scale systems and smaller systems that grow very fast.
Continue Reading
The Singleton Pattern: OOP Techniques in PHP
Posted on 02. Mar, 2009 by Will Fitch.
The singleton pattern is a common pattern used to make resources exclusive in that there is one of a particular type of resource. The most common usage of this is database connectivity. Typically, an application only wants a single connection to a single database server at any given time. This is where the singleton pattern comes in.
Continue Reading
Using PHP Namespaces
Posted on 24. Apr, 2008 by Will Fitch.
PHP 5.3 introduces a much requested feature for object-oriented programmers: namespaces. At the time of this writing, version 5.3 of PHP was in development, but is planned on being released in the near future.
One of the purposes object-oriented programming is to remove ambiguous development and data access items. This basically means identifying common [...]



