debuggable

 
Contact Us
 

What are Design Patterns

Posted on 27/4/07 by Tim Koschützki

What are Design Patterns?

In software engineering in general, and PHP web development in particular, design patterns are general repeatable solutions to commonly occurring problems. A design pattern is not a finished design that can be transformed directly into code - it is more like a description or template for how to solve a problem that can be used in many different situations.

In PHP web development not all design patterns are known play a big role. However, the once that play a role, play a major one and are often discussed on forums. The implementation of design patterns in PHP is sometimes not very easy and there has been a lot of discussion going on in the past about the differences between certain patterns and the differences of patterns in web development and application programming.

By the way, algorithms are not thought of as design patterns, since they solve computational problems rather than design problems.

The design patterns described on PHP-Design-Patterns.com share the same architecture. There are many approaches to writing articles or even book about design patterns and every author has to choose one. I have decided to follow a similar approach to the Gang of Four Book:

  • The name of the design pattern is important, because it creates a unique terminology for a given problem and the pattern that solves it. Via communicating a design pattern's name to fellow programmers, they all know what kind of problem you are facing and how you intent to solve it.
  • The kinds of problems to which the pattern should be applied is discussed in the When to apply it section. Of course, a discussion about when not to apply can be foun there too.
  • The Implementation section of the patterns on PHP-Design-Patterns.com discusses in detail possible pitfalls when implementing the pattern. This rather big section shows you code snippets and any further information that you need to successfully apply the patterns to problems.
  • In Web Development, a rather limited field for software design, certain patterns appear over and over again in special parts of web application. Those parts are named in the Known Uses section and are discussed there.
  • As often as in application programming, design patterns go alongside each other in PHP web development, too. Relatonships between patterns and way how patterns can be best used together are discussed in the Related Patterns section.

Now people think that by applying a design pattern they get full-fletched tried-and-true-design. That's not really true. Please read on when you want to know how design pattern solve problems.

 
&nsbp;

You can skip to the end and add a comment.

Rick Jayne said on May 01, 2007:

This is also a good source of information on design patterns:

http://phpatterns.com

It was made by Harry Fuechs, who is also the author of the PHP Anthology Books.

This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.