Book Image

Learning Python Design Patterns - Second Edition - Second Edition

By : Chetan Giridhar, Gennadiy Zlobin
Book Image

Learning Python Design Patterns - Second Edition - Second Edition

By: Chetan Giridhar, Gennadiy Zlobin

Overview of this book

With the increasing focus on optimized software architecture and design it is important that software architects think about optimizations in object creation, code structure, and interaction between objects at the architecture or design level. This makes sure that the cost of software maintenance is low and code can be easily reused or is adaptable to change. The key to this is reusability and low maintenance in design patterns. Building on the success of the previous edition, Learning Python Design Patterns, Second Edition will help you implement real-world scenarios with Python’s latest release, Python v3.5. We start by introducing design patterns from the Python perspective. As you progress through the book, you will learn about Singleton patterns, Factory patterns, and Façade patterns in detail. After this, we’ll look at how to control object access with proxy patterns. It also covers observer patterns, command patterns, and compound patterns. By the end of the book, you will have enhanced your professional abilities in software architecture, design, and development.
Table of Contents (19 chapters)
Learning Python Design Patterns Second Edition
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Foreword

 

"Controlling complexity is the essence of computer programming."

 
 --Brian Kernighan
 

"All problems in computer science can be solved by another level of indirection (abstraction)."

 
 --David Wheeler

The preceding two quotes by two well known computer scientists illustrate the problem faced by the modern software designer—coming up with a good, stable, reusable, flexible solution to a software design problem.

Design patterns solve the preceding problems in the most elegant way. Design patterns abstract and present in neat, well-defined components and interfaces the experience of many software designers and architects over many years of solving similar problems. These are solutions that have withstood the test of time with respect to reusability, flexibility, scalability, and maintainability.

There have been many books on design patterns with the well-known Gang of Four (GoF) book forming the cornerstone of nearly the entire domain.

However, in this era of web and mobile computing, where programs tend to get written in high-level languages such as Python, Ruby, and Clojure, there is often a need for books that translate the rather esoteric language used in such books into more familiar terms, with reusable code written in these newer, more dynamic programming languages. This is especially true when it comes to newbie programmers who often tend to get lost in the complexities of design versus implementation and often require an expert helping hand.

This book fulfills that role very well. It uses the template of design patterns as laid out in the GoF book and adds a few others as well for completion—but before jumping into the patterns itself, gives the young and inexperienced reader the fundamentals of software design principles that have gone into the thinking behind the creation and evolution of these design patterns. It doesn't walk the gentle reader blindly into the maze of the pattern world, but lays out the fundamentals well before opening that door and carrying the reader along that path of learning.

The book is written with Python as the language for implementing the sample code for the patterns—and this makes excellent sense. As someone who has spent more than 12 years in the company of this wonderful programming language, I can attest to its beauty and simplicity and its effectiveness in solving problems ranging from routine to the most complex. Python is ideally suited to the rookie and young programmer, and with the ease of learning it, it is also a lot of fun to code in. The young programmer would find their time spent in the company of Python along in this book very rewarding and fruitful.

Chetan Giridhar has been working and contributing to Python for well over 7 years. He is ideally suited for the job of penning a book like this, as he has gone through some of the cycles of learning the complexities of implementation and design himself and has learned well through that process. He is a well-known speaker on a number of varied topics in Python and has delivered well-attended talks at Python conferences, such as PyCon India. He was amongst the invited speakers for conferences in the USA, Asia-Pacific, and New Zealand.

I believe this book, Learning Python Design Patterns, Second Edition, would be an excellent addition to the Learning series by Packt Publishing and would provide a set of skills to the toolbox of the young Python programmer that would take them gently and expertly to being able to design modular and efficient programs in Python.

Anand B Pillai

CTO—Skoov.com

Board Member—Python Software Foundation

Founder—Bangalore Python User's Group