Download presentation
Presentation is loading. Please wait.
1
Abstract Factory Pattern
2
Abstract Factory Pattern
Intent Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Also known as “Kit” Motivating example A UI toolkit wants to support multiple looks and feels for their widgets, and need to create UI widgets of consistent look.
3
Back to PizzaStore For pizzas of different regions, the same ingredients are made differently. NY pizza should use NY style ingredients
4
Ingredient Factory
5
Implement Ingredient Factory
6
Rework the Pizza
7
A Concrete Pizza
8
Revisit PizzaStore
9
Abstract Factory
10
Note Abstract Factory pattern uses Factory Method pattern to create concrete product Abstract Factory create families of products that belong together When product need to be added or removed, the factory interface needs to be changed
11
Dependency Inversion Principle
Depend on abstraction, do not depend on concrete classes.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.