Patterns





Introduction

In 1994, Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides published Design Patterns (Addison Wesley). The book quickly became a computer science classic because of its useful material, and it even pioneered a new metalanguage in the engineering and architecture communities. The book's underlying principle, which was to provide a set of patterns of object structure and intra-object structure, was adopted from building architecture and was smoothly applied to programming.

The set of 40 patterns presented in the book were gleaned from years of experience. Each pattern was presented in a language-neutral form, and most could be applied to any development environment.

A few of the patterns, such as the Iterator pattern, were specifically developed to make up for shortcomings in a language (in the case of Iterator, that language was C++). PHP implements the Iterator pattern inherently through the foreach method.


Patterns have been notoriously underused in PHP. Not until the advent of PHP 5 were the language and environment taken seriously in the enterprise software development community. Now, with a robust object model, solid IDEs, and wide developer adoption, the enterprise community is starting to notice PHP. Several books on PHP have recently covered the use of patterns in the language, and I think it's worth visiting them here.

In this book, I chose to use the original Design Patterns book as reference. I chose a subset of patterns from that book to implement here; these patterns and their implementations are solid architectural foundations, as well as sources of inspiration for your own code.



 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows