QUESTIONABLE Object Creation Patterns in Python 🤔

Описание к видео QUESTIONABLE Object Creation Patterns in Python 🤔

💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide.

Sometimes it's good to talk about what not to do when designing software. In this video, I talk about the singleton and object pool patterns, both of which are object creation design patterns. I'll show you how they work in Python and discuss why the singleton pattern in particular is something you shouldn't use. The object pool can be considered a generalization of the singleton pattern, and it has its uses, but it has a few caveats.

A few interesting links to articles and books:
Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides: https://amzn.to/3jllgyH
Principles of Package Design: Creating Reusable Software Components by Matthias Noback: https://amzn.to/2NETK3l
Clean Code: A Handbook of Agile Software Craftsmanship by Robert Martin: https://amzn.to/3qVZgNs
The original Design Principles and Design Patterns article by Robert Martin: https://fi.ort.edu.uy/innovaportal/fi...
About singletons in Python: https://stackoverflow.com/questions/6...

My gear:
📷 Sony A7C - https://amzn.to/3aShCtw
🎙 Rode Wireless GO - https://amzn.to/3pSLFVU
💡 GVM RGB LED light - https://amzn.to/3qRNJid
💡 GVM 100W light with lantern softbox - https://amzn.to/2NuU8lk

You can find the code I worked on in this episode in my GitHub repository: https://github.com/arjancodes/betterp...

All parts in this series:
Part 1: Cohesion and coupling -    • Cohesion and Coupling: Write BETTER P...  
Part 2: Dependency inversion -    • Dependency Inversion: Write BETTER PY...  
Part 3: The strategy pattern -    • The Strategy Pattern: Write BETTER PY...  
Part 4: The observer pattern -    • Observer Pattern Tutorial: I NEVER Kn...  
Part 5: Unit testing and code coverage -    • 100% CODE COVERAGE - Think You're Don...  
Part 6: Template method and bridge -    • Two UNDERRATED Design Patterns 💡 Writ...  
Part 7a: Exception handling -    • Exception Handling Tips in Python ⚠ W...  
Part 7b: Monadic error handling -    • Monadic Error Handling in Python ⚠ Wr...  
Part 8: Software architecture -    • Why You Should Think About SOFTWARE A...  
Part 9: SOLID principles -    • Uncle Bob’s SOLID Principles Made Eas...  
Part 10: Object creation patterns -    • QUESTIONABLE Object Creation Patterns...  

👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!

🏆 Join my Discord server: https://discord.arjan.codes
👥Twitter:   / arjancodes  
👥LinkedIn:   / arjancodes  
👥Facebook:   / arjancodes  

🔖 Chapters:
0:00 Intro
0:28 Design pattern categories
1:14 The singleton
2:42 Singleton code example
5:38 Why singletons are an anti-pattern
6:47 The object pool
7:33 Object pool code example
11:34 Object pool with context manager
13:20 Limitations and caveats of the object pool
14:32 Gag reel

#arjancodes #softwaredesign #singleton

DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!

Комментарии

Информация по комментариям в разработке