Contact Us

The various kinds of Design Patterns

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

A way to classify design patterns

Design Patterns differ in their level of abstraction and their intent to improve the design. Since there are quite many design patterns that have been discovered already, there must be a way to classify them. Again, there are many approaches to organize design patterns and I personally prefer the approach of the number one book about the subject - the Gang of Four Book, which structures design patterns into the following categories:

  • Behavioral Patterns
  • Creational Patterns
  • Structural Patterns

More categories

The GoF book focuses on design patterns from a desktop application point of view though. Since we want to delve more into the topic of design patterns in php webdevelopment, there are two more categories that we need to take into account:

  • Domain-Logic Patterns
  • Presentation-related Patterns

Let's look at them at a greater detail.

Behavioral Patterns

Behavioral Patterns are concerned with algorithmns and the dispatching of responsibilities between objects. They describe the patterns of communication between these objects. They shift your focus away from flow of control to concentrate on the way your objects are interconnected.

Typical patterns for this category are:

  • Chain of Responsibility
  • The Observer Pattern
  • The Command Pattern
  • The Iterator Pattern

Creational Patterns

Creational Design Patterns help you with creating objects. They abstract the instantiation process of objects and thereby help make a system independent of how its objects are created and composed.
There are two reoccurring things in these patterns. Firstly, they hide which concrete classes the system uses to create objects. Secondly, They hide how instances of these classes are created and put together.

Typical creational design patterns are:

  • The Factory Method
  • The Singleton Pattern
  • The Prototype Pattern

Structural Patterns

Structural Design Patterns deal with how objects can be combined into larger structures and composite objects. The design patterns in this category use either object composition or class inheritance to form these larger structures.
The motivation behind this composing of objects could either be grouping related objects together, forming compositions as they are present in real life, adapting a class' interface or extending a class' interface and capabilities at runtime.

Typical Patterns in this category are:

  • Adapter Pattern
  • Composite Pattern
  • Decorator Pattern

Domain-Logic Patterns

In desktop applications domain-logic patterns have a really large scope. They can help with structuring the workflow and assign responsibilities to the proper objects. Since we are mainly concerned with web applications, the patterns in this category are closely related to databases. They help you represent a database-row or even a table as an object and perform all changes you would make to the database via the object.

Typical Patterns in this category are:

  • Active Record Pattern
  • Data Mapper Pattern
  • Table Data Gateway Pattern

Presentation-related Patterns

Presentation-related patterns are a must-use for web applications. We want to show something on our websites, after all! Only in intranets or backend scripts will we have an architecture that needs no real presentation. Think of database backup scripts. However, even those may print "Okay, backup successful" - a form of presentation. Structure your application into layers and stick to the presentation-patterns presented in this category.

Typical Patterns are:

  • Template-View
  • Transform-View


That's it for our brief overview over the various kinds of design patterns. I have presented one way to structure them and there are many others. In the coming few weeks we will study design patterns in detail.

Have a good one all!


You can skip to the end and add a comment.

Tim Koschuetzki said on Jun 03, 2007:

Yes there are plenty of other types, too. They are dedicated to topics that evolve around enterprise applications. Think of shared and embedded systems, threading, scalability, etc.

Sumit Lole  said on Nov 25, 2009:

Thanks for your past. It helped me in basic understanding of Design Pattern & its categorization. It also cleared my vision for using which pattern & when?

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.