21 октября 2008

Five common PHP design patterns

07:36 18.10.2008


Five common PHP design patterns


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.





Editor’s note: See the follow-up article “Five more PHP design patterns” to learn about five additional design patterns that you might find useful.



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.










оригинал поста

Комментариев нет:

Архив блога

What to do?

Problem:
you have site designed in a dark theme, saying dark background, white font.
By default google toolbar autocomplete cracks html for inputs or selects containg "email" "name" "address" and other buzzwords and changes background to yellow. As a result when visitor fills form, he enters text as white on yellow and can not easy validate his input
What to do?

Таги

Followers

item http://www.voronenko.com/2008/10/five-common-php-design-patterns.html