You are previewing Mastering Python Design Patterns.
O'Reilly logo
Mastering Python Design Patterns

Book Description

Create various design patterns to master the art of solving problems using Python

In Detail

Python is an object-oriented, scripting language that is used in wide range of categories. In software engineering, a design pattern is a recommended solution to a software design problem. Although not new, design patterns remain one of the hottest topics in software engineering and they come as a ready reference for software developers to solve the common problems they face at work.

This book will take you through each and every design pattern explained with the help of real-world examples. The aim of the book is to introduce more low-level detail and concepts on how to write Pythonic code, not just focusing on common solutions as implemented in Java and C++. It includes small sections on troubleshooting, best practices, system architecture, and its design aspects. With the help of this book, you will be able to understand Python design pattern concepts and the framework, as well as issues and their resolution. You'll focus on all 16 design patterns that are used to solve everyday problems.

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

  • Extend an object without subclassing using the Decorator pattern

  • Keep the logic decoupled from the UI using the MVC pattern

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Mastering Python Design Patterns
      1. Table of Contents
      2. Mastering Python Design Patterns
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. Design patterns
        2. Common misunderstandings about design patterns
        3. Design patterns and Python
        4. What this book covers
        5. What you need for this book
        6. Who this book is for
        7. Conventions
        8. Reader feedback
        9. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. The Factory Pattern
        1. Factory Method
          1. A real-life example
          2. A software example
          3. Use cases
          4. Implementation
        2. Abstract Factory
          1. A real-life example
          2. A software example
          3. Use cases
          4. Implementation
        3. Summary
      9. 2. The Builder Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      10. 3. The Prototype Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      11. 4. The Adapter Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      12. 5. The Decorator Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      13. 6. The Facade Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      14. 7. The Flyweight Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      15. 8. The Model-View-Controller Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      16. 9. The Proxy Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      17. 10. The Chain of Responsibility Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      18. 11. The Command Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      19. 12. The Interpreter Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      20. 13. The Observer Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      21. 14. The State Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      22. 15. The Strategy Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      23. 16. The Template Pattern
        1. A real-life example
        2. A software example
        3. Use cases
        4. Implementation
        5. Summary
      24. Index