Mastering Python Design Patterns
A guide to creating smart, efficient, and reusable software, 2nd Edition
Kamon Ayeva, Sakis Kasampalis
- 248 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Mastering Python Design Patterns
A guide to creating smart, efficient, and reusable software, 2nd Edition
Kamon Ayeva, Sakis Kasampalis
About This Book
Exploit various design patterns to master the art of solving problems using Python
Key Features
- Master the application design using the core design patterns and latest features of Python 3.7
- Learn tricks to solve common design and architectural challenges
- Choose the right plan to improve your programs and increase their productivity
Book Description
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 fnd sections on corrections, best practices, system architecture, and its designing aspects. This book will help you learn the core concepts of design patterns and the way they can be used to resolve software design problems. You'll focus on most of the Gang of Four (GoF) design patterns, which are used to solve everyday problems, and take your skills to the next level with reactive and functional patterns that help you build resilient, scalable, and robust applications. By the end of the book, you'll be able to effciently address commonly faced problems and develop applications, and also be comfortable working on scalable and maintainable projects of any size.
What you will learn
- 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
- Keep the logic decoupled from the UI using the MVC pattern
- Leverage the Observer pattern to understand reactive programming
- Explore patterns for cloud-native, microservices, and serverless architectures
Who this book is for
This book is for intermediate Python developers. Prior knowledge of design patterns is not required to enjoy this book.
Frequently asked questions
Information
Microservices and Patterns for the Cloud
- The Retry pattern
- The Circuit Breaker pattern
- The Cache-Aside pattern
- The Throttling pattern
The Microservices pattern
- Since it uses a single code base, the development team has to work on maintaining the whole code base simultaneously
- It is more difficult to organize testing and reproduce and fix bugs
- Tests and deployments become difficult to manage as the application and its user base grows and its constraints increase
Real-world examples
.NET Foundation (https://github.com/dotnet-architecture). It is described as an easy-to-get-started sample reference microservice and container-based application.
Use cases
- There is a requirement to support different clients, including desktop and mobile
- There is an API for third parties to consume
- We have to communicate with other applications using messaging
- We serve requests by accessing a database, communicating with other systems, and returning the right type of response (JSON, XML, HTML or even PDF)
- There are logical components corresponding to different functional areas of the application