The Factory Pattern in Python // Separate Creation From Use

ArjanCodes
ArjanCodes
In this video, I explain what the Factory pattern (or: Abstract Factory) is, and how to use it in Python. One of the greatest th ...
In this video, I explain what the Factory pattern (or: Abstract Factory) is, and how to use it in Python. One of the greatest things about this pattern is that it allows you to separate creation from use. It's one of my most-used patterns.

The code I worked on in this video is available here: https://github.com/ArjanCodes/2021-fa....

💡 Here's my FREE 7-step guide to help you consistently design great software: https://arjancodes.com/designguide.

🎓 Courses:
The Software Designer Mindset: https://www.arjancodes.com/mindset
The Software Designer Mindset Team Packages: https://www.arjancodes.com/sas
The Software Architect Mindset: Pre-register now! https://www.arjancodes.com/architect
Next Level Python: Become a Python Expert: https://www.arjancodes.com/next-level...
The 30-Day Design Challenge: https://www.arjancodes.com/30ddc

🛒 GEAR & RECOMMENDED BOOKS: https://kit.co/arjancodes.

💬 Join my Discord server here: https://discord.arjan.codes
🐦Twitter: Twitter: arjancodes
🌍LinkedIn: LinkedIn: arjancodes
🕵Facebook: Facebook: arjancodes

👀 Channel code reviewer board:
- Ryan Laursen
- Sybren A. Stüvel

🔖 Chapters:
0:00 Intro
0:37 Explaining the example
3:25 Analysis of the code
4:46 What is the Factory pattern?
5:31 Creating the abstract ExporterFactory
7:06 Creating the concrete factories
8:47 Revising the main() function
10:51 Running the new version of the code
11:43 Analysis of the new version
12:11 Bonus: inject the factory as a dependency
13:28 When to (not) use the factory pattern

#arjancodes #softwaredesign #python

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!

همه توضیحات ...