Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Python Design Patterns

You're reading from   Mastering Python Design Patterns A guide to creating smart, efficient, and reusable software

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher
ISBN-13 9781788837484
Length 248 pages
Edition 2nd Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Sakis Kasampalis Sakis Kasampalis
Author Profile Icon Sakis Kasampalis
Sakis Kasampalis
Kamon Ayeva Kamon Ayeva
Author Profile Icon Kamon Ayeva
Kamon Ayeva
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. The Factory Pattern FREE CHAPTER 2. The Builder Pattern 3. Other Creational Patterns 4. The Adapter Pattern 5. The Decorator Pattern 6. The Bridge Pattern 7. The Facade Pattern 8. Other Structural Patterns 9. The Chain of Responsibility Pattern 10. The Command Pattern 11. The Observer Pattern 12. The State Pattern 13. Other Behavioral Patterns 14. The Observer Pattern in Reactive Programming 15. Microservices and Patterns for the Cloud 16. Other Books You May Enjoy

Use cases

The decorator pattern shines when used for implementing cross-cutting concerns (j.mp/wikicrosscut). Examples of cross-cutting concerns are as follows:

  • Data validation
  • Caching
  • Logging

  • Monitoring
  • Debugging
  • Business rules
  • Encryption

In general, all parts of an application that are generic and can be applied to many other parts of it are considered to be cross-cutting concerns.

Another popular example of using the decorator pattern is graphical user interface (GUI) toolkits. In a GUI toolkit, we want to be able to add features such as borders, shadows, colors, and scrolling to individual components/widgets.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image