Design Patterns in WordPress: We're Just Getting Started

Throughout this series, we've been taking a look at a few design patterns and how they are applicable to software development - specifically WordPress development.

The thing about design patterns is that there is a wide variety of them and it would be near impossible to do justice to each of the patterns in a series here on the blog. Nonetheless, hopefully taking a look at these three have helped kickstart your interest in using design patterns in your work.

To wrap up this series, I wanted to provide a list of other patterns, resources, and guides that you may find useful if you've found this particular series useful in your development endeavors.

A List of Design Patterns

Here's the thing: The list of design patterns isn't fixed. There are some that have been established for quite some time.

The truth is, the patterns even have various permutations based on the environment in which they're implemented - this is why I think it's so important to understand the core pattern so that you can adapt it to your needs, or so you can recognize it in the wild so that - should the need arise - you can continue to implement your work in a way that plays nicely with the existing implementation.

With that said, I can't possibly list out all of the design patterns here. I can list out many of the popular patterns along with some links to their corresponding Wikipedia articles so you have a few to review.

For those that are listed above, I recommend at least reading through each of the articles. Many of the them will likely be applicable to your day-to-day work especially if you're working on larger applications. Even if you're working on a smaller project, they're still applicable and beneficial.

After that, we'll take a look at two books that I highly recommend for developers to have on their desk at any given time.


Whenever others ask me for resources on design patterns, there are really only two books that I recommend. Both of them are listed below along with links, a short description of each, why I recommend them, and the target audience for each of them.

Head First Design Patterns

Head First Design Patterns

Head First Design Patterns is a relatively new book in comparison to a lot of the material that's available today. It uses a different teaching style than many classical books or text books in that it uses a lot of humor, lots of pictures, diagrams, humor, and so on.

Personally, I'm a fan of its style but I know that some may reject it.

Nonetheless, the book covers the following patterns:

  • The Strategy Pattern
  • The Observer Pattern
  • The Decorator Pattern
  • The Simple Factory Pattern
  • The Factory Pattern
  • The Singleton Pattern
  • The Command Pattern
  • The Adapter Pattern
  • The Facade Pattern
  • The Template Method Pattern
  • The Iterator Pattern
  • The Composite Pattern
  • The State Pattern
  • The Proxy Pattern
  • The Compound Pattern
  • And a list of other common patterns that we've listed in the first part of this article.

If you're looking for a book to get started in design patterns, then this is the book with which I'd start.

Design Patterns: Elements of Reusable Object-Oriented Software

Gang of Four

This book is also known as The Gang of Four Book because it was written by four accomplished software engineers. It's a more technical read than Head First Design Patterns, but I still recommend it as the description of the patterns and the provided diagrams and implementations are easy to follow.

I will say that if you're just now venturing into the world of design patterns, I'd start with Head First and then read this book; otherwise, this one may seem a bit more dry or less interesting.

Nonetheless, here's the list of patterns the Gang of Four provide in their book:

  • The Abstract Pattern
  • The Builder Pattern
  • The Factory Pattern
  • The Prototype Pattern
  • The Singleton Pattern
  • The Chain of Responsibility
  • The Command Pattern
  • The Interpreter Pattern
  • The Iterator Pattern
  • The Mediator Pattern
  • The Memento Pattern
  • The Observer Pattern
  • The State Pattern
  • The Strategy Pattern
  • The Template Method Pattern
  • The Adapter Pattern
  • The Bridge Pattern
  • The Composite Pattern
  • The Decorator Pattern
  • The Facade Pattern
  • The Flyweight Pattern
  • The Proxy Pattern

In addition to covering the patterns, the book also uses case studies to show actual implementations of the pattern in real world examples which I think can be incredibly useful when referring to them in your work.


One of the dangers for people who first discover design patterns is the propensity to try to apply them everywhere, but don't do that: design patterns offer a lot of advantages in software development, but they have their place and things should not be forced into a pattern.

They should fit naturally.

In short, don't try to use patterns for the sake of using a pattern, use them when their design fits the problem that you're trying to solve.

With that said, we've wrapped up the Design Patterns in WordPress series.

To summarize:

  • We've covered the Observer Pattern and how we can setup our code to fire events and to publish them to other objects that are interested.
  • We've reviewed how to setup our plugins so that a single instance of the plugin is always accessible throughout the lifetime of the plugin, theme, or application
  • We also took a detailed look at the Simple Factory pattern that included a demo application, diagram, and sample code

All in all, it feels as if we've covered a lot of ground. The truth is, there's still much to review. If you've found this particular series interesting, or want to take a deeper dive into the topics at hand, be sure to review the design patterns listed earlier in this article, or read the two books that are linked above.



Related Articles