Design Patterns in Python

This post is 2 things;

  1. A statement of intent
  2. An apology for inaction

Recently this blog has not been nearly as active as I would like it to be. This is due to many things but mostly me simply being very busy.

So that’s the apology done, now for the statement of intent!

I have intended to write a short e-book about design patterns using the python programming language. This is inspired by the aptly titled Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides who are collectively known as the Gang of Four (GOF).

While I started to write this as an e-book, I now think the way to do this is write a blog post per design pattern and then compile them into a guide which I will keep here. This is much in the same way that Rafe Kettler wrote his guide to pythons magic methods which can be found here.

Why do I want to do this? I want to write this to pass on some knowledge which I have gained working as a software engineer, but also to learn a lot. I think of these as the twin goals of this blog because if I write about something I want to get it right. While I know quite a bit about some design patterns there are others I definitely don’t.

Here is the list of the design patterns I hope to tackle.

  • Creational
    • Abstract Factory
    • Builder
    • Factory Method
    • Prototype
    • Singleton
  • Structural
    • Adapter
    • Bridge
    • Composite
    • Decorator
    • Facade
    • Flyweight
    • Proxy
  • Behavioural
    • Chain of Responsibility
    • Command
    • Interpreter
    • Iterator
    • Mediator
    • Memento
    • Observer
    • State
    • Strategy
    • Template
    • Visitor
  • UI Patterns
    • Model View Presenter (MVP)
    • Model View Controller (MVC)
    • Model View View-Model (MVVM)

The first 3 sections are directly from the GOF book and that is where I am drawing most of my inspiration from. However that book used examples from C++ and smalltalk and I believe that writing in python will simplify this hugely.

I have already started this endeavour writing in LaTex and it and my examples are already on my gitHub account here.

Hopefully my first article will be along shortly. (oh and Happy New Year and thanks for reading)


1 Response to “Design Patterns in Python”

  1. January 29, 2014 at 3:50 pm

    haven’t had a full look yet but copied one to my memory stick and hope to use it on my laptop. I use wx python and want to start with the MVC pattern, so this is a big help thanks for the work you put in 🙂


What did you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Call Me
Endorse davidcorne on Coderwall



© 2013 by David Corne.

Creative Commons License

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

%d bloggers like this: