This is the code repository for Mastering Python Design Patterns, Second Edition, published by Packt.
A guide to creating smart, efficient, and reusable software
Python is an object-oriented scripting language that is used in a wide range of categories. In software engineering, a design pattern is an elected solution for solving software design problems. Although they have been around for a while, design patterns remain one of the top topics in software engineering, and are a ready source for software developers to solve the problems they face on a regular basis. This book takes you through a variety of design patterns and explains them with real-world examples. You will get to grips with low-level details and concepts that show you how to write Python code, without focusing on common solutions as enabled in Java and C++. You'll also find sections on corrections, best practices, system architecture, and its designing aspects. This book covers the following exciting features:
- Explore Factory Method and Abstract Factory for object creation
- Clone objects using the Prototype pattern
- Make incompatible interfaces compatible using the Adapter pattern
- Secure an interface using the Proxy pattern
- Choose an algorithm dynamically using the Strategy pattern
If you feel this book is for you, get your copy today!
- Chapter 9, Implementation of Proxy Pattern section: The code block following the sentence "Let's recapitulate the full code of the proxy.py file:" is incorrect. The correction can be found at https://github.com/PacktPublishing/Mastering-Python-Design-Patterns-Second-Edition/blob/master/ERRATUM-PYTHON-DESIGN-PATTERN-PROXY.pdf.
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
class Musician:
def __init__(self, name):
self.name = name
def __str__(self):
return f'the musician {self.name}'
def play(self):
return 'plays music'
Following is what you need for this book: This book is for intermediate Python developers. Prior knowledge of design patterns is not required to enjoy this book.
With the following software and hardware list you can run all code files present in the book (Chapter 1-15).
Chapter | Software required | OS required |
---|---|---|
All chapters | Python 3.6.x | Windows, Mac OS X, and Linux (Any) |
Chapter 15 | SQLite 3.22.0 or later | Windows, Mac OS X, and Linux (Any) |
Chapter 15 | RabbitMQ 3.7.7 | Windows, Mac OS X, and Linux (Any) |
Kamon Ayeva is a web developer/DevOps engineer working with a variety of tools. He spends most of his time building projects using Python's powerful scripting capabilities, add-on libraries, and web frameworks such as Django or Flask. Kamon has been using Python in professional contexts for more than 12 years. He is also a Python instructor with a passion for teaching how to use Python features to quickly produce results.
Sakis Kasampalis is a software engineer living in the Netherlands. He is not dogmatic about particular programming languages and tools; his principle is that the right tool should be used for the right job. One of his favorite tools is Python because he finds it very productive. Sakis was also the technical reviewer of Mastering Object-oriented Python and Learning Python Design Patterns, published by Packt Publishing.
Click here if you have any feedback or suggestions.