SlideShare a Scribd company logo
1 of 23
Download to read offline
Design Patterns
in Swift
Ch 5
Abstract Factory
Builder
Sai Li @ Yowoo Tech.
taipingeric@gmail.com
2017/7/27
1. Factory Method
2. Strategy
3. Decorator
4. Composite
5. Iterator
6. Template Method
7. Abstract Factory
8. Builder
9. Singleton
10. Proxy
11. Adaptor
Kerievsky Joshua: A Learning Guide To Design Patterns
12. Bridge
13. Mediator
14. Observer
15. Chain of Responsibility
16. Memento
17. Command
18. Prototype
19. State
20. Visitor
21. Flyweight
22. Interpreter
23. Facade
Kerievsky Joshua: A Learning Guide To Design Patterns
purpose
creational structural behavioral
scope
class Factory Method Adaptor
Interpreter
Template Method
object
Abstract Factory
Builder
Prototype
Singleton
Adapter
Bridge
Composite
Decorator
Facade
Flyweight
Proxy
Chain of Responsibility
Command
Iterator
Mediator
Memento
Observer
State
Strategy
Visitor
Abstract Factory
Abstract Factory - Intent
Provide an interface for creating families of related or
dependent objects without specifying their concrete
classes.
以同⼀一個介⾯面來來建立⼀一整族相關或相依的物件,不需
點明個物件真正所屬的具象類別
A.K.A: Kit
5
Abstract Factory
• system should be independent of how its products are
created, composed, and represented.
• system should be configured with one of multiple
families of products.
• reveal just their interfaces, not their implementations.
6
interface : declares operations
that create abstract objects
implements the operations to
create concrete objects
interface of the products
objects created by Concrete Factory
implementation of AbstractProduct
Abstract Factory
• Isolate concrete class: hiding product class name,
not in client code
• Easy to exchange product family: change factory
only
• Consistency
• Singleton factory: one and only one
8
MealSet with different burger and drink?
1. Factory Method
2. Strategy
3. Decorator
4. Composite
5. Iterator
6. Template Method
7. Abstract Factory
8. Builder
9. Singleton
10. Proxy
11. Adaptor
Kerievsky Joshua: A Learning Guide To Design Patterns
12. Bridge
13. Mediator
14. Observer
15. Chain of Responsibility
16. Memento
17. Command
18. Prototype
19. State
20. Visitor
21. Flyweight
22. Interpreter
23. Facade
Kerievsky Joshua: A Learning Guide To Design Patterns
purpose
creational structural behavioral
scope
class Factory Method Adaptor
Interpreter
Template Method
object
Abstract Factory
Builder
Prototype
Singleton
Adapter
Bridge
Composite
Decorator
Facade
Flyweight
Proxy
Chain of Responsibility
Command
Iterator
Mediator
Memento
Observer
State
Strategy
Visitor
Builder
Builder - Intent
Separate the construction of a complex object from
its representation so that the same construction
process can create different representations
16
interface: create parts of a product
construct and assemble parts
retrieving product
using builder to construct
parts
Builder
• Vary product’s internal representation: hide
representation and internal structure of product and
how the product get assembled
• Isolates codes for construction and representation: hide
implementation, easy to exchange
• One step -> step-by-step
19
Abstract Factory v.s Builder
• For constructing complex objects
• Family v.s step-by-step
22
References
• 搞笑談軟⼯工
23
Q & A

More Related Content

Similar to Design Patterns in Swift Ch5 Abstract Factory Builder

Александр Белецкий "Архитектура Javascript приложений"
 Александр Белецкий "Архитектура Javascript приложений" Александр Белецкий "Архитектура Javascript приложений"
Александр Белецкий "Архитектура Javascript приложений"Agile Base Camp
 
React tech talk @ CMU
React tech talk @ CMUReact tech talk @ CMU
React tech talk @ CMUAlan Dong
 
Visitor Pattern
Visitor PatternVisitor Pattern
Visitor PatternIder Zheng
 
Building Scalable JavaScript Apps
Building Scalable JavaScript AppsBuilding Scalable JavaScript Apps
Building Scalable JavaScript AppsGil Fink
 
Model View Presenter
Model View Presenter Model View Presenter
Model View Presenter rendra toro
 
Introduction to design_patterns
Introduction to design_patternsIntroduction to design_patterns
Introduction to design_patternsamitarcade
 
Lessons-Learned-SwiftUI.pptx
Lessons-Learned-SwiftUI.pptxLessons-Learned-SwiftUI.pptx
Lessons-Learned-SwiftUI.pptxMohammad Azam
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design PatternsLilia Sfaxi
 
Continuous Integration and Continuous Deployment (CI/CD) with WSO2 Enterprise...
Continuous Integration and Continuous Deployment (CI/CD) with WSO2 Enterprise...Continuous Integration and Continuous Deployment (CI/CD) with WSO2 Enterprise...
Continuous Integration and Continuous Deployment (CI/CD) with WSO2 Enterprise...WSO2
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.pptAnkitPangasa1
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.pptbryafaissal
 
Design Patterns Course
Design Patterns CourseDesign Patterns Course
Design Patterns CourseAhmed Soliman
 
Design patterns difference between interview questions
Design patterns   difference between interview questionsDesign patterns   difference between interview questions
Design patterns difference between interview questionsUmar Ali
 
Full Stack Web Development Course - Brochure - Manojkumar C - Fresh Spar Tech...
Full Stack Web Development Course - Brochure - Manojkumar C - Fresh Spar Tech...Full Stack Web Development Course - Brochure - Manojkumar C - Fresh Spar Tech...
Full Stack Web Development Course - Brochure - Manojkumar C - Fresh Spar Tech...Manojkumar C
 

Similar to Design Patterns in Swift Ch5 Abstract Factory Builder (20)

Александр Белецкий "Архитектура Javascript приложений"
 Александр Белецкий "Архитектура Javascript приложений" Александр Белецкий "Архитектура Javascript приложений"
Александр Белецкий "Архитектура Javascript приложений"
 
React tech talk @ CMU
React tech talk @ CMUReact tech talk @ CMU
React tech talk @ CMU
 
Visitor Pattern
Visitor PatternVisitor Pattern
Visitor Pattern
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Cellery overview
Cellery overviewCellery overview
Cellery overview
 
Lezione 03 Introduzione a react
Lezione 03   Introduzione a reactLezione 03   Introduzione a react
Lezione 03 Introduzione a react
 
Building Scalable JavaScript Apps
Building Scalable JavaScript AppsBuilding Scalable JavaScript Apps
Building Scalable JavaScript Apps
 
Model View Presenter
Model View Presenter Model View Presenter
Model View Presenter
 
Introduction to design_patterns
Introduction to design_patternsIntroduction to design_patterns
Introduction to design_patterns
 
Lessons-Learned-SwiftUI.pptx
Lessons-Learned-SwiftUI.pptxLessons-Learned-SwiftUI.pptx
Lessons-Learned-SwiftUI.pptx
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Continuous Integration and Continuous Deployment (CI/CD) with WSO2 Enterprise...
Continuous Integration and Continuous Deployment (CI/CD) with WSO2 Enterprise...Continuous Integration and Continuous Deployment (CI/CD) with WSO2 Enterprise...
Continuous Integration and Continuous Deployment (CI/CD) with WSO2 Enterprise...
 
Design pattern
Design patternDesign pattern
Design pattern
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.ppt
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.ppt
 
Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
 
Design Patterns Course
Design Patterns CourseDesign Patterns Course
Design Patterns Course
 
Design patterns difference between interview questions
Design patterns   difference between interview questionsDesign patterns   difference between interview questions
Design patterns difference between interview questions
 
Full Stack Web Development Course - Brochure - Manojkumar C - Fresh Spar Tech...
Full Stack Web Development Course - Brochure - Manojkumar C - Fresh Spar Tech...Full Stack Web Development Course - Brochure - Manojkumar C - Fresh Spar Tech...
Full Stack Web Development Course - Brochure - Manojkumar C - Fresh Spar Tech...
 
Vue.js Use Cases
Vue.js Use CasesVue.js Use Cases
Vue.js Use Cases
 

More from Chihyang Li

Image Style Transfer and AI on iOS Mobile App
Image Style Transfer and AI on iOS Mobile AppImage Style Transfer and AI on iOS Mobile App
Image Style Transfer and AI on iOS Mobile AppChihyang Li
 
Image style transfer and iOS CoreML, Vision Frameworks
Image style transfer and iOS CoreML, Vision FrameworksImage style transfer and iOS CoreML, Vision Frameworks
Image style transfer and iOS CoreML, Vision FrameworksChihyang Li
 
Machine Learning in Swift
Machine Learning in SwiftMachine Learning in Swift
Machine Learning in SwiftChihyang Li
 
Image style transfer & AI on App
Image style transfer & AI on AppImage style transfer & AI on App
Image style transfer & AI on AppChihyang Li
 
iOS Vision framework
iOS Vision frameworkiOS Vision framework
iOS Vision frameworkChihyang Li
 
Swift map & flatMap
Swift map & flatMapSwift map & flatMap
Swift map & flatMapChihyang Li
 
Swift Optional ??
Swift Optional ??Swift Optional ??
Swift Optional ??Chihyang Li
 
Scrum & Kanban Introduction
Scrum & Kanban IntroductionScrum & Kanban Introduction
Scrum & Kanban IntroductionChihyang Li
 
Design Patterns in Swift ch0 Introduction
Design Patterns in Swift ch0 IntroductionDesign Patterns in Swift ch0 Introduction
Design Patterns in Swift ch0 IntroductionChihyang Li
 
Object Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISPObject Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISPChihyang Li
 
Object Oriented Programming in Swift Ch2 Polymorphism, OCP, LSP
Object Oriented Programming in Swift Ch2 Polymorphism, OCP, LSPObject Oriented Programming in Swift Ch2 Polymorphism, OCP, LSP
Object Oriented Programming in Swift Ch2 Polymorphism, OCP, LSPChihyang Li
 
Object Oriented Programming in Swift Ch1 - Inheritance
Object Oriented Programming in Swift Ch1 - InheritanceObject Oriented Programming in Swift Ch1 - Inheritance
Object Oriented Programming in Swift Ch1 - InheritanceChihyang Li
 
Object Oriented Programming in Swift Ch0 - Encapsulation
Object Oriented Programming in Swift Ch0 - EncapsulationObject Oriented Programming in Swift Ch0 - Encapsulation
Object Oriented Programming in Swift Ch0 - EncapsulationChihyang Li
 
Apple Swift API Design Guideline
Apple Swift API Design GuidelineApple Swift API Design Guideline
Apple Swift API Design GuidelineChihyang Li
 
DevOps 2016 summit
DevOps 2016 summitDevOps 2016 summit
DevOps 2016 summitChihyang Li
 
Slack introduction
Slack introductionSlack introduction
Slack introductionChihyang Li
 
Agile Development: Scrum introduction
Agile Development: Scrum introductionAgile Development: Scrum introduction
Agile Development: Scrum introductionChihyang Li
 

More from Chihyang Li (18)

Image Style Transfer and AI on iOS Mobile App
Image Style Transfer and AI on iOS Mobile AppImage Style Transfer and AI on iOS Mobile App
Image Style Transfer and AI on iOS Mobile App
 
Image style transfer and iOS CoreML, Vision Frameworks
Image style transfer and iOS CoreML, Vision FrameworksImage style transfer and iOS CoreML, Vision Frameworks
Image style transfer and iOS CoreML, Vision Frameworks
 
Machine Learning in Swift
Machine Learning in SwiftMachine Learning in Swift
Machine Learning in Swift
 
Image style transfer & AI on App
Image style transfer & AI on AppImage style transfer & AI on App
Image style transfer & AI on App
 
iOS Vision framework
iOS Vision frameworkiOS Vision framework
iOS Vision framework
 
Swift map & flatMap
Swift map & flatMapSwift map & flatMap
Swift map & flatMap
 
Swift Optional ??
Swift Optional ??Swift Optional ??
Swift Optional ??
 
Scrum & Kanban Introduction
Scrum & Kanban IntroductionScrum & Kanban Introduction
Scrum & Kanban Introduction
 
Design Patterns in Swift ch0 Introduction
Design Patterns in Swift ch0 IntroductionDesign Patterns in Swift ch0 Introduction
Design Patterns in Swift ch0 Introduction
 
Object Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISPObject Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISP
 
Object Oriented Programming in Swift Ch2 Polymorphism, OCP, LSP
Object Oriented Programming in Swift Ch2 Polymorphism, OCP, LSPObject Oriented Programming in Swift Ch2 Polymorphism, OCP, LSP
Object Oriented Programming in Swift Ch2 Polymorphism, OCP, LSP
 
Object Oriented Programming in Swift Ch1 - Inheritance
Object Oriented Programming in Swift Ch1 - InheritanceObject Oriented Programming in Swift Ch1 - Inheritance
Object Oriented Programming in Swift Ch1 - Inheritance
 
Object Oriented Programming in Swift Ch0 - Encapsulation
Object Oriented Programming in Swift Ch0 - EncapsulationObject Oriented Programming in Swift Ch0 - Encapsulation
Object Oriented Programming in Swift Ch0 - Encapsulation
 
Apple Swift API Design Guideline
Apple Swift API Design GuidelineApple Swift API Design Guideline
Apple Swift API Design Guideline
 
Swift capture
Swift captureSwift capture
Swift capture
 
DevOps 2016 summit
DevOps 2016 summitDevOps 2016 summit
DevOps 2016 summit
 
Slack introduction
Slack introductionSlack introduction
Slack introduction
 
Agile Development: Scrum introduction
Agile Development: Scrum introductionAgile Development: Scrum introduction
Agile Development: Scrum introduction
 

Recently uploaded

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 

Design Patterns in Swift Ch5 Abstract Factory Builder

  • 1. Design Patterns in Swift Ch 5 Abstract Factory Builder Sai Li @ Yowoo Tech. taipingeric@gmail.com 2017/7/27
  • 2. 1. Factory Method 2. Strategy 3. Decorator 4. Composite 5. Iterator 6. Template Method 7. Abstract Factory 8. Builder 9. Singleton 10. Proxy 11. Adaptor Kerievsky Joshua: A Learning Guide To Design Patterns 12. Bridge 13. Mediator 14. Observer 15. Chain of Responsibility 16. Memento 17. Command 18. Prototype 19. State 20. Visitor 21. Flyweight 22. Interpreter 23. Facade Kerievsky Joshua: A Learning Guide To Design Patterns
  • 3. purpose creational structural behavioral scope class Factory Method Adaptor Interpreter Template Method object Abstract Factory Builder Prototype Singleton Adapter Bridge Composite Decorator Facade Flyweight Proxy Chain of Responsibility Command Iterator Mediator Memento Observer State Strategy Visitor
  • 5. Abstract Factory - Intent Provide an interface for creating families of related or dependent objects without specifying their concrete classes. 以同⼀一個介⾯面來來建立⼀一整族相關或相依的物件,不需 點明個物件真正所屬的具象類別 A.K.A: Kit 5
  • 6. Abstract Factory • system should be independent of how its products are created, composed, and represented. • system should be configured with one of multiple families of products. • reveal just their interfaces, not their implementations. 6
  • 7. interface : declares operations that create abstract objects implements the operations to create concrete objects interface of the products objects created by Concrete Factory implementation of AbstractProduct
  • 8. Abstract Factory • Isolate concrete class: hiding product class name, not in client code • Easy to exchange product family: change factory only • Consistency • Singleton factory: one and only one 8
  • 9.
  • 10.
  • 11.
  • 12. MealSet with different burger and drink?
  • 13. 1. Factory Method 2. Strategy 3. Decorator 4. Composite 5. Iterator 6. Template Method 7. Abstract Factory 8. Builder 9. Singleton 10. Proxy 11. Adaptor Kerievsky Joshua: A Learning Guide To Design Patterns 12. Bridge 13. Mediator 14. Observer 15. Chain of Responsibility 16. Memento 17. Command 18. Prototype 19. State 20. Visitor 21. Flyweight 22. Interpreter 23. Facade Kerievsky Joshua: A Learning Guide To Design Patterns
  • 14. purpose creational structural behavioral scope class Factory Method Adaptor Interpreter Template Method object Abstract Factory Builder Prototype Singleton Adapter Bridge Composite Decorator Facade Flyweight Proxy Chain of Responsibility Command Iterator Mediator Memento Observer State Strategy Visitor
  • 16. Builder - Intent Separate the construction of a complex object from its representation so that the same construction process can create different representations 16
  • 17. interface: create parts of a product construct and assemble parts retrieving product using builder to construct parts
  • 18.
  • 19. Builder • Vary product’s internal representation: hide representation and internal structure of product and how the product get assembled • Isolates codes for construction and representation: hide implementation, easy to exchange • One step -> step-by-step 19
  • 20.
  • 21.
  • 22. Abstract Factory v.s Builder • For constructing complex objects • Family v.s step-by-step 22