Book Image

Mastering Python Design Patterns

By : Sakis Kasampalis
Book Image

Mastering Python Design Patterns

By: Sakis Kasampalis

Overview of this book

Table of Contents (23 chapters)
Mastering Python Design Patterns
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
The Factory Pattern
Index

A software example


The django-oscar-datacash module is a Django third-party module that integrates with the DataCash payment gateway. The module has a Gateway class that provides fine-grained access to the various DataCash APIs. On top of that, it also offers a Facade class that provides a less granular API (for those who don't want to mess with the details) and the ability to save transactions for auditing purposes [j.mp/oscarfac].

Caliendo, an interface for mocking Python APIs, contains a facade module which uses the Facade pattern for doing many different but useful things, such as caching methods and deciding what to return based on the input object which is passed to the top-level Facade method [j.mp/caliendofac].