Learning Python Design Patterns: A practical and fast-paced guide exploring
Python design patterns
Download
Introduction
Python is a great programming language, elegant and concise, and at the
same time, very powerful. It has all the essential object-oriented features and
can be used to implement design patterns. A design pattern is a general reusable
solution to a commonly occurring problem within a given context. In everyday
work, a programmer faces issues that have been solved so many times in the past
by other developers that they have evolved common patterns to solve them.
The design pattern is not a concrete step to solve a problem, such as an algorithm;
it is rather a practice or a description of how to solve a problem that can be used in
different situations and implemented in different languages.
The design pattern accelerates the development process, providing a proven practice
to solve some type of problem. It is often more preferable than using an unproven
one because invisible problems often occur during the implementation, and the
solving of unforeseen problems slows down the development dramatically.
Besides that, it's a tool of communication between programmers. It's much easier to
say, "We use here the observer design pattern" rather than describing what the code
actually does.
Studying design patterns is a good next step on the road to becoming a great
developer, and this book is a good jumpstart.
What this book covers
Chapter 1, Model-View-Controller, describes what the model, view, and controller are,
how to use them together, and ends with the implementation of a very simple URL
shortening service.
Chapter 2, Creating Only One Object with the Singleton Pattern, describes ways to
create a class whose instantiated object will only be one throughout the lifecycle
of an application.
Chapter 3, Building Factories to Create Objects, describes the simple factory, Factory
Method, Abstract Factory patterns, and how to use them to separate object creation.
Chapter 4, The Facade Design Pattern, is about simplifying the interface of a complex
subsystem to facilitate the development.
Chapter 5, Facilitating Object Communication with Proxy and Observer Patterns, is
a pattern for implementing a publisher-subscriber model and a proxy, which
provides an object that controls access to another object.
Chapter 6, Encapsulating Calls with the Command Pattern, describes a pattern that
encapsulates an action and its parameters.
Chapter 7, Redefining Algorithms with the Template Method, is about a pattern
that provides the ability to create variations of the algorithm with minimum
modifications.
What you need for this book
You will require a Python 2.7 installation. It's usually available out of the box
on most Unix and Linux distributives and can be downloaded and installed on
Windows from http://python.org/.
Who this book is for
This book is for developers with an intermediate Python knowledge who want to
make learning design patterns their next step in their development career