This is not an introductory Python book. This book assumes you’ve learned the basics of Python elsewhere. This is a book about design that I have been working on for years, basically ever since I first started trying to read Design Patterns (Gamma, Helm, Johnson & Vlissides, Addison-Wesley, 1995), commonly referred to as the Gang of Four or just GoF).
There is a chapter on design patterns in the first edition of Thinking in C++, which has evolved in Volume 2 of the second edition of Thinking in C++, and you’ll also find a chapter on patterns in the first edition of Thinking in Java. I took that chapter out of the second edition of Thinking in Java because that book was getting too big, and also because I had decided to write Thinking in Patterns. That book, still to be finished, has become this one. The ease of expressing these more complex ideas in Python will, I think, finally allow me to get it all out. In addition, I assume you have more than just a grasp of the syntax of Python. You should have a good understanding of objects and what they’re about, including polymorphism. On the other hand, by going through this book you’re going to learn a lot about object-oriented programming by seeing objects used in many different situations. If your knowledge of objects is rudimentary, it will get much stronger in the process of understanding the designs in this book.
Table of Contents
- A quick course in Python for programmers
- The pattern concept
- Unit Testing
- Building application frameworks
- Fronting for an implementation
- Decorators: dynamic type selection
- Iterators: decoupling algorithms from containers
- Factories: encapsulating object creation
- Function objects
- Changing the interface
- Table-driven code: configuration flexibility
- Multiple dispatching
- Pattern refactoring