Free Sample
+ Collection

Learning Python Design Patterns

Learning
Gennadiy Zlobin

Written for intermediate Python programmers, this excellent tutorial will help streamline your work through the use of Design Patterns. You’ll learn through example and clear explanations to expand your know-how and speed up your output.
$7.50
$24.99
RRP $14.99
RRP $24.99
eBook
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783283378
Paperback100 pages

About This Book

  • Explore the Model-View-Controller pattern and learn how to build a URL shortening service
  • All design patterns use a real-world example that can be modified and applied in your software
  • No unnecessary theory! The book consists of only the fundamental knowledge that you need to know

Who This Book Is For

If you are an intermediate level Python user, this book is for you. Prior knowledge of Python programming is essential. Some knowledge of UML is also required to understand the UML diagrams which are used to describe some design patterns.

Table of Contents

Chapter 1: Model-View-Controller
Model – the knowledge of the application
View – the appearance of knowledge
Controller – the glue between the model and view
Benefits of using the MVC
Implementation in Python
Summary
Chapter 2: Creating Only One Object with the Singleton Pattern
A module-level singleton
A classic singleton
The borg singleton
Implementation in Python
Summary
Chapter 3: Building Factories to Create Objects
The Factory Method
Abstract Factory
Abstract Factory versus Factory Method
Summary
Chapter 4: The Facade Design Pattern
The Facade design pattern
Facades in Python's standard library
Implementation in Python
Summary
Chapter 5: Facilitating Object Communication with Proxy and Observer Patterns
Proxy design pattern
Observer design pattern
Summary
Chapter 6: Encapsulating Calls with the Command Pattern
Command Pattern terminology
Use cases of the Command design pattern
Advantages and disadvantages of the Command design pattern
Implementation in Python
Summary
Chapter 7: Redefining Algorithms with the Template Method
The Template Method design pattern
Implementation in Python
Summary

What You Will Learn

  • Create different implementations of the same algorithm with the least modifications
  • Implement the publisher-subscriber pattern
  • Create an object when only one instance of it is needed
  • Create a simple interface using the Facade design pattern
  • Increase the functionality while leaving the interface unchanged

In Detail

Design pattern is a well-known approach to solve some specific problems which each software developer comes across during his work. Design patterns capture higher-level constructs that commonly appear in programs. If you know how to implement the design pattern in one language, typically you will be able to port and use it in another object-oriented programming language.

The choice of implementation language affects the use of design patterns. Naturally, some languages are more applicable for certain tasks than others. Each language has its own set of strengths and weaknesses. In this book, we introduce some of the better known design patterns in Python. You will learn when and how to use the design patterns, and implement a real-world example which you can run and examine by yourself.

You will start with one of the most popular software architecture patterns which is the Model- View-Controller pattern. Then you will move on to learn about two creational design patterns which are Singleton and Factory, and two structural patterns which are Facade and Proxy. Finally, the book also explains three behavioural patterns which are Command, Observer, and Template.

Authors

Read More

Recommended for You

Learning Python Data Visualization
$ 28.99