Factory Pattern Use Case : Design Patterns In Python

Channel:
Subscribers:
24,900
Published on ● Video Link: https://www.youtube.com/watch?v=ywTF3yTAe3M



Duration: 5:59
2,642 views
45


Factory Design Pattern Article : https://medium.com/design-patterns-in-python/factory-pattern-in-python-2f7e1ca45d3e

Documentation : https://sbcode.net/python/factory/#example-use-case

An example use case is a user interface where the user can select from a menu of items, such as chairs.

The user has been given a choice using some kind of navigation interface, and it is unknown what choice, or how many the user will make until the application is actually running and the user starts using it.

So, when the user selected the chair, the factory then takes some property involved with that selection, such as an ID, Type or other attribute and then decides which relevant subclass to instantiate in order to return the appropriate object.

(Book) Sometimes you just want to switch off your computer and read from a book. So, this pattern, plus all other GoF patterns are discussed in my Design Patterns In Python book
https://www.amazon.com/dp/B08XLJ8Z2J : ASIN B08XLJ8Z2J
https://www.amazon.com/dp/B08Z282SBC : ASIN B08Z282SBC

#factory
#factoryPattern
#designPatterns
#pythonDesignPatterns







Tags:
Design Patterns In Python
B08XLJ8Z2J
factory pattern
factory pattern use case
B08Z282SBC