[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ossig] More PHP Design Patterns
A good introduction to some common patterns in PHP.
Five common PHP design patterns
Design patterns are just for Java™ architects -- at least that's
what you may have been led to believe. In fact, design patterns
are useful for everyone. If these tools aren't exclusive to
architecture astronauts, what are they, and why are they useful
in PHP applications? This article explains.
Design patterns were introduced to the software community in Design
Patterns, by Erich Gamma, Richard Helm, Ralph Johnson, and John
Vlissides (colloquially known as the "gang of four"). The core concept
behind design patterns, presented in the introduction, was simple. Over
their years of developing software, Gamma et al found certain patterns
of solid design emerging, just as architects designing houses and
buildings can develop templates for where a bathroom should be located
or how a kitchen should be configured. Having those templates, or design
patterns, means they can design better buildings more quickly. The same
applies to software.
Design patterns not only present useful ways for developing robust
software faster but also provide a way of encapsulating large ideas in
friendly terms. For example, you can say you're writing a messaging
system to provide for loose coupling, or you can say you're writing an
observer, which is the name of that pattern.
It's difficult to demonstrate the value of patterns using small
examples. They often look like overkill because they really come into
play in large code bases. This article can't show huge applications, so
you need to think about ways to apply the principles of the example --
and not necessarily this exact code -- in your larger applications.
That's not to say that you shouldn't use patterns in small applications.
Most good applications start small and become big, so there is no reason
not to start with solid coding practices like these.
Now that you have a sense of what design patterns are and why they're
useful, it's time to jump into five common patterns for PHP V5.
More information on the patterns at the site itself:
To unsubscribe: send mail to firstname.lastname@example.org
with "unsubscribe ossig" in the body of the message