REVIEW - Python Programming with Design Patterns


Python Programming with Design Patterns


James W. Cooper




Pearson Addison-Wesley (2021)




Ian Bruntlett


September 2022



Verdict: Recommended with reservations.

There are three main strands to this book – Python 3, the tkinter (GUI library) and Design Patterns.

The Python 3 material, Part 5 of the book, provides ‘A Brief Introduction to Python’. Whilst this is a brave effort, I would recommend the reader get to grips with Python before getting started with this book. My Python was a bit rusty so I found reading the first 9 chapters of an introductory book quite helpful in this respect. Some of the code requires additional modules to be installed – if they aren’t, some of the example code crashes with a ModuleNotFoundError (the book does cover the use of pip to install additional modules but I would have liked coverage of additional tools). Failing that, there is always Google and

The tkinter GUI library coverage is spread over some dedicated chapters as well as throughout the main chapters covering the design patterns. During the course of this review I had to read widely – referring to material on the Internet and in books. The official Python website has a helpful page on tkinter and that led me to referring to the GUI section of Programming Python. Not being used to Python’s built-in help, I failed to realise I could get tkinter help via the Python command line – import tkinter; followed by help(tkinter.Button). Yes, I am a newbie.

The Design Patterns chapters take up the bulk of this book, using the patterns catalogued by the Design Patterns (GoF, Gang of Four – Gamma, Helm, Johnson and Vlissides) catalogue. I am not an expert in Design Patterns and this strand was the key reason for me reading this book. The author has already produced design patterns books for C# and Java so I am trusting that he gets his coverage correct. Like the GoF book, coverage is split into three categories – Creational (6 patterns), Structural (7 patterns), and Behavioural (11 patterns). It refers to a Python website,, which I did not have time to study closely.

One downside of Design Patterns is a proliferation of classes in your system – coupled with the tkinter library, the logic of the examples here is scattered throughout the source code.

The Creational Patterns section covers the usual suspects. It starts with an overview of Creational Patterns, has a chapter for each pattern, and concludes with a Summary of Creational Patterns. I found the Factory Method chapter to be opaque because it is based on handling a swimming meet and I don’t follow sports at all. The Structural Patterns section, like the Creational Patterns section, starts with an overview and concludes with a summary. The Behavioural Patterns section, like previous sections, starts with an overview and, strangely enough does not conclude with a summary.

Other observations:

  • It would have been nice to know the author’s perspective on the basics of Object Orientation and the SOLID acronym.
  • The author provides some diagrams using his own format. More class and object diagrams of the author’s code would have been helpful, as well as an explanation of the format used.
  • Difficult to read on its own – the text has snippets of code from the examples – the full source code for the examples is downloadable from the book’s dedicated GitHub site (which is invaluable). This makes this book less suited for bus/train journeys. Also, there are quite a few sloppy mistakes in the text, making for confusing reading.
  • It is slightly biased towards running on Windows. There are a few glitches – for example in chapter 3, a datafile was named States.txt but most of the code there referred to it as states.txt, resulting in a runtime exception.
  • There are a few cases of GUI examples throwing exceptions ( is one of them) but carrying on to work OK.
  • The example source code would have been better if it had followed Item 49 of Effective Python – provide “Docstrings for every Function, Class and Module”.

This book is best studied in parallel with the original Design Patterns book as it complements it with Python specific examples. Neither are an easy read but the writing is less academic than that of the Design Patterns book and some readers will find that helpful.

This is an interesting, albeit flawed, book. Due to my inexperience with Patterns I was unable to audit the source code as thoroughly as I wished. This is more of an examples book than a catalogue (for which the Design Patterns book is recommended). I was impressed by what the author could persuade tkinter to provide. It is quite a topic. This book would be most appropriate for someone familiar with Python 3 who wants to learn about Design Patterns and the Python tkinter GUI module – alongside sources on Python, tkinter, and Design Patterns.

Overall, I think it would be best to quote the GoF: “Don’t worry if you don’t understand this book completely on the first reading. We didn’t understand it all on the first writing!”.


Some useful websites used in the course of this review…