Abstract Factory Pattern – Design Patterns (ep 5)

preview_player
Показать описание
Video series on Design Patterns for Object Oriented Languages. This time we look at the Abstract Factory Pattern.

💙 BUY MY BOOK:

► The playlist

► Head First: Design Patterns

► Design Patterns: Elements of Reusable Object-Oriented Software

💪 Patreon Community

📚 Products I Recommend
Рекомендации по теме
Комментарии
Автор

I study and improve not only patterns but also English. Thank you for clearful and not boring lessons =)

worldown
Автор

It's 2023 and I am watching the series (of course with pen and notebook ready). Thank you very much Chris! The value you add is huge.

mesesamboby
Автор

Finally understood the difference between Factory Method Pattern and Abstract Factory Pattern.
Thank you very much. Great series!

Alarith
Автор

This is a great video, you covered the pattern very well. I wanted to add one additional point which you will see in many implementations of this pattern: When you have multiple concrete implementations of a factory, you have the same problem you had when faced with multiple concrete implementations of a product. You want to get the type of product you need, but don't want to get your hands dirty with the business logic involved in creating it. With multiple concrete factories, how can you apply a polymorphic solution for creating the correct type of factory? The answer is a factory of factories. The same way we abstractify the logic for creating products, we can abstractify the logic for creating factories that produce families of products.


Let's use your operating system example: You want platform-specific UI's, and have created UI factories for Mac OS, Linux, and Windows. Maybe you also have subclasses of those factories for things like light mode, dark mode, accessibility mode, etc. When the program begins, you detect the operating system and graphical settings, and send those details to your factory of UI factories. You are given back the correct concrete UI factory implementation specific to your needs, and can start producing UI elements. Without this extra polymorphic layer, you may be faced with the same problem that the factory pattern was devised to solve.

vicinityconcepts
Автор

The UI example was so much clearer than the Head First pizza examples! This makes sense in a way that I can use it for my own projects, thanks!

slipperydippery
Автор

Please include code examples as they really help cement the idea, like you did in decorator pattern.

adamsolkar
Автор

Freaking HERO - I have been banging my head against the wall for about 2 hours trying to understand Abstract Factory Patterns and you managed to clarify everything in about 25 min. The recap of the definition at the end really brought everything together. Thanks for helping me not fail my CS course

nametakenfan
Автор

Man, this video series might be ever green when you are done with it! youtube has connected us in an observer pattern in that since I subscribed, I get updates on your current videos :D

tivmego
Автор

Men, Chris, your energy is infectious, lots of love. Thanks a bunch

briannkurunungi
Автор

The example of Dark and Light mode was beautiful. It gave the most clarity about the use case of abstract factory. Kudos!

ayushdayani
Автор

Posted years ago, yet this one still the best explanation I found so far..
Thanks (a lot) Chris..!!

AfriandiHaryanto
Автор

Literally been trying to wrap my head around the abstract factory pattern for the longest time and your video finally helped me understand what it is and why is is love your teaching Thank you so much!

Jacob-bzhn
Автор

I tried to understand this via wikipedia's diagrams and descriptions, but it was too overwhelming for me couple of weeks ago. And now they are REALLY simple. Great thanks to you, man. You are really sticking to KISS principle :)). thank you again

vislobokovaleksander
Автор

Thank you. Much easier to understand as a visual learner.

utsavshrestha
Автор

Finally watched Christopher video at 1.5x speed. Because I had already watched his previous factory design pattern video :) :P

AgrawalRajat
Автор

This is some premium explanation making complex topics simple to understand, and I love the way you repeat things so that the idea gets cemented into our head, hats off to you sir, great explanation I hope you never stop doing these, We novice developers need people like you.. :)

rajeev
Автор

Thanks for the awesome videos!
I think the main difference between Factory Method and Abstract Factory is that Factory Method relies on inheritance and let subclass decides how to create object through the factory method(s), whereas Abstract Factory uses composition, client gets an object that implements abstract factory interface and uses that object to create items.
Abstract Factory is at a higher level since it is an object, while factory method is only a method.

Hdjandbkwk
Автор

It must be a hell of a feeling to read all these comments and see how helpful you are to others, keep it up please, you are good at this, thank you!

youcefsb
Автор

25:00 really hits the nail on it's head. Thank you for the nice work!

cdarius
Автор

Your teaching style is so nice and easy. Thanks a lot

ShyamSharma-pgzu