PacktLib: Learning Python Design Patterns

Learning Python Design Patterns

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

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

Creating Only One Object with the Singleton Pattern

A module-level singleton

A classic singleton

The borg singleton

Implementation in Python

Summary

Building Factories to Create Objects

The Factory Method

Abstract Factory

Abstract Factory versus Factory Method

Summary

The Facade Design Pattern

The Facade design pattern

Facades in Python's standard library

Implementation in Python

Summary

Facilitating Object Communication with Proxy and Observer Patterns

Proxy design pattern

Observer design pattern

Summary

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

Redefining Algorithms with the Template Method

The Template Method design pattern

Implementation in Python

Summary

Index