SlideShare a Scribd company logo
CODE LIKE A NINJA
CREATIONAL DESIGN PATTERNS
SESSION RESOURCES
• Presentation session notes including link to this session, will be available on
http://learningaboutfudge.blogspot.com
• All the source for this session is publically available at:
https://github.com/SheepWorx/Training
• RSS Feed:
http://learningaboutfudge.blogspot.com/feeds/posts/default?alt=rss
• Local Network: dmeyer-msharetrainingCode Like a Ninja
• Source was compiled using Visual Studio 2012
• http://www.gofpatterns.com/
Design Patterns
Creational Design Patterns
Structural Design Patterns
Behavioral Design Patterns
CREATIONAL DESIGN PATTERNS
Definition
Creational design patterns are design patterns that deal with object
creation mechanisms, trying to create objects in a manner suitable to
the situation.
• Abstract Factory
• Builder
• Factory Method
• Prototype
• Singleton
CREATIONAL DESIGN PATTERNS
FACTORY (ABSTRACT AND METHOD)
• Lets a class defer instantiation into subclasses
• Allows you to introduce new classes without modifying the code
• Factory Method: when you need to delegate the creation of single
objects
• Abstract Factory: When you need to delegate the creation of families
of related or dependant objects without specifying the concrete
classes
SIMPLE FACTORY
Client Factory
Concrete
Class 1
Concrete
Class 2
Concrete
Class 2
Base
class/
interface
SIMPLE FACTORY
• Classes that need to be instantiated need to inherit from a common
class (abstract class or interface)
• The factory will receive some form of identifier and create the correct
concrete class
• Will return it via its base class (abstract class or interface)
SIMPLE FACTORY
See simple factory code example
Question(s):
What will happen when we need to add new types
FACTORY METHOD
Client
Concrete
Factory 1
Concrete
Factory 2
Base
Factory
Concrete
Class 1
Concrete
Class 2
Base
class/
interface
FACTORY METHOD
• Classes you want to create must inherit from a base object (abstract class or
interface)
• Each class will have its own factory
• The factories themselves will inherit off a base factory (abstract class)
• Base factory will control behaviour while individual factories will be
responsible for returning concrete instances of the desired class
• If unique logic exists for a particular class, I recommend it be encapsulated
within its factory
FACTORY METHOD – WHEN TO USE IT
It should be used when…
• A class cannot anticipate the class of objects it must create
• A class wants it subclasses to specify the objects it creates
• Classes delegate responsibility to one of several helper classes and
you want to localize the knowledge of which helper subclass is the
delegate
FACTORY METHOD – BENEFITS
• Eliminates the need to bind application classes to your code
The code only deals with the interface
• Enables subclasses to provide an extended version of an object
because creating an object inside a class is more flexible than
creating the object directly in the client
FACTORY METHOD
See factory method code example
ABSTRACT FACTORY
Client
Abstract
Factory
Abstract
Product A
Abstract
Product B
Concrete
Factory 1
Concrete
Factory 2 Product A2
Product
B2
Product
B1
Product A1
ABSTRACT FACTORY
• Provides an interface for creating families of related or dependant
objects without specifying their concrete classes
• The client interacts only with the product interfaces and the abstract
factory class. It thus never knows about the concrete construction
provided by this pattern
• Abstract factory is similar to the factory method, except it creates
families of related objects.
ABSTRACT FACTORY – WHEN TO USE IT
It should be used when…
• The system should be independent of how its products are created,
composed and represented
• The system should be configured with one of multiple families of
products
• The family of related product objects is designed to be used together
and you must enforce this constraint.
ABSTRACT FACTORY– BENEFITS
• Isolates concrete classes
• Makes exchanging product families easy
• Promotes consistency among products
ABSTRACT FACTORY
See abstract factory code example
SESSION RESOURCES
• Presentation session notes including link to this session, will be available on
http://learningaboutfudge.blogspot.com
• All the source for this session is publically available at:
https://github.com/SheepWorx/Training
• RSS Feed:
http://learningaboutfudge.blogspot.com/feeds/posts/default?alt=rss
• Local Network: dmeyer-msharetrainingCode Like a Ninja
• Source was compiled using Visual Studio 2012
• http://www.gofpatterns.com/

More Related Content

Similar to Code Like a Ninja Session 7 - Creational Design Patterns

Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
Srikanth R Vaka
 
JS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptxJS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptx
husnainali397602
 
Sda 8
Sda   8Sda   8
Design patterns
Design patternsDesign patterns
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
stanbridge
 
Factory Pattern
Factory PatternFactory Pattern
Factory Pattern
Deepti C
 
Weekly Meeting: Basic Design Pattern
Weekly Meeting: Basic Design PatternWeekly Meeting: Basic Design Pattern
Weekly Meeting: Basic Design Pattern
Nguyen Trung Kien
 
Prototype design patterns
Prototype design patternsPrototype design patterns
Prototype design patterns
Thaichor Seng
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
anguraju1
 
Factory Pattern
Factory PatternFactory Pattern
Factory Pattern
Monjurul Habib
 
Factory method pattern
Factory method patternFactory method pattern
Factory method pattern
Shahriar Iqbal Chowdhury
 
Design Patterns - Abstract Factory Pattern
Design Patterns - Abstract Factory PatternDesign Patterns - Abstract Factory Pattern
Design Patterns - Abstract Factory Pattern
Mudasir Qazi
 
Design patterns
Design patternsDesign patterns
Design patterns
Alok Guha
 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
University of Technology
 
Csc253 chapter 09
Csc253 chapter 09Csc253 chapter 09
Csc253 chapter 09
PCC
 
Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
Julie Iskander
 
Object-oriented programming 3.pptx
Object-oriented programming 3.pptxObject-oriented programming 3.pptx
Object-oriented programming 3.pptx
Adikhan27
 
Desing Patterns Summary - by Jim Fawcett
Desing Patterns Summary - by Jim FawcettDesing Patterns Summary - by Jim Fawcett
Desing Patterns Summary - by Jim Fawcett
Dareen Alhiyari
 
Unit 2-Design Patterns.ppt
Unit 2-Design Patterns.pptUnit 2-Design Patterns.ppt
Unit 2-Design Patterns.ppt
MsRAMYACSE
 
Effective java
Effective javaEffective java
Effective java
Emprovise
 

Similar to Code Like a Ninja Session 7 - Creational Design Patterns (20)

Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
 
JS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptxJS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptx
 
Sda 8
Sda   8Sda   8
Sda 8
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
 
Factory Pattern
Factory PatternFactory Pattern
Factory Pattern
 
Weekly Meeting: Basic Design Pattern
Weekly Meeting: Basic Design PatternWeekly Meeting: Basic Design Pattern
Weekly Meeting: Basic Design Pattern
 
Prototype design patterns
Prototype design patternsPrototype design patterns
Prototype design patterns
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
Factory Pattern
Factory PatternFactory Pattern
Factory Pattern
 
Factory method pattern
Factory method patternFactory method pattern
Factory method pattern
 
Design Patterns - Abstract Factory Pattern
Design Patterns - Abstract Factory PatternDesign Patterns - Abstract Factory Pattern
Design Patterns - Abstract Factory Pattern
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
 
Csc253 chapter 09
Csc253 chapter 09Csc253 chapter 09
Csc253 chapter 09
 
Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
 
Object-oriented programming 3.pptx
Object-oriented programming 3.pptxObject-oriented programming 3.pptx
Object-oriented programming 3.pptx
 
Desing Patterns Summary - by Jim Fawcett
Desing Patterns Summary - by Jim FawcettDesing Patterns Summary - by Jim Fawcett
Desing Patterns Summary - by Jim Fawcett
 
Unit 2-Design Patterns.ppt
Unit 2-Design Patterns.pptUnit 2-Design Patterns.ppt
Unit 2-Design Patterns.ppt
 
Effective java
Effective javaEffective java
Effective java
 

Recently uploaded

Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 

Recently uploaded (20)

Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 

Code Like a Ninja Session 7 - Creational Design Patterns

  • 1. CODE LIKE A NINJA CREATIONAL DESIGN PATTERNS
  • 2. SESSION RESOURCES • Presentation session notes including link to this session, will be available on http://learningaboutfudge.blogspot.com • All the source for this session is publically available at: https://github.com/SheepWorx/Training • RSS Feed: http://learningaboutfudge.blogspot.com/feeds/posts/default?alt=rss • Local Network: dmeyer-msharetrainingCode Like a Ninja • Source was compiled using Visual Studio 2012 • http://www.gofpatterns.com/
  • 3. Design Patterns Creational Design Patterns Structural Design Patterns Behavioral Design Patterns
  • 4. CREATIONAL DESIGN PATTERNS Definition Creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.
  • 5. • Abstract Factory • Builder • Factory Method • Prototype • Singleton CREATIONAL DESIGN PATTERNS
  • 6. FACTORY (ABSTRACT AND METHOD) • Lets a class defer instantiation into subclasses • Allows you to introduce new classes without modifying the code • Factory Method: when you need to delegate the creation of single objects • Abstract Factory: When you need to delegate the creation of families of related or dependant objects without specifying the concrete classes
  • 7. SIMPLE FACTORY Client Factory Concrete Class 1 Concrete Class 2 Concrete Class 2 Base class/ interface
  • 8. SIMPLE FACTORY • Classes that need to be instantiated need to inherit from a common class (abstract class or interface) • The factory will receive some form of identifier and create the correct concrete class • Will return it via its base class (abstract class or interface)
  • 9. SIMPLE FACTORY See simple factory code example Question(s): What will happen when we need to add new types
  • 10. FACTORY METHOD Client Concrete Factory 1 Concrete Factory 2 Base Factory Concrete Class 1 Concrete Class 2 Base class/ interface
  • 11. FACTORY METHOD • Classes you want to create must inherit from a base object (abstract class or interface) • Each class will have its own factory • The factories themselves will inherit off a base factory (abstract class) • Base factory will control behaviour while individual factories will be responsible for returning concrete instances of the desired class • If unique logic exists for a particular class, I recommend it be encapsulated within its factory
  • 12. FACTORY METHOD – WHEN TO USE IT It should be used when… • A class cannot anticipate the class of objects it must create • A class wants it subclasses to specify the objects it creates • Classes delegate responsibility to one of several helper classes and you want to localize the knowledge of which helper subclass is the delegate
  • 13. FACTORY METHOD – BENEFITS • Eliminates the need to bind application classes to your code The code only deals with the interface • Enables subclasses to provide an extended version of an object because creating an object inside a class is more flexible than creating the object directly in the client
  • 14. FACTORY METHOD See factory method code example
  • 15. ABSTRACT FACTORY Client Abstract Factory Abstract Product A Abstract Product B Concrete Factory 1 Concrete Factory 2 Product A2 Product B2 Product B1 Product A1
  • 16. ABSTRACT FACTORY • Provides an interface for creating families of related or dependant objects without specifying their concrete classes • The client interacts only with the product interfaces and the abstract factory class. It thus never knows about the concrete construction provided by this pattern • Abstract factory is similar to the factory method, except it creates families of related objects.
  • 17. ABSTRACT FACTORY – WHEN TO USE IT It should be used when… • The system should be independent of how its products are created, composed and represented • The system should be configured with one of multiple families of products • The family of related product objects is designed to be used together and you must enforce this constraint.
  • 18. ABSTRACT FACTORY– BENEFITS • Isolates concrete classes • Makes exchanging product families easy • Promotes consistency among products
  • 19. ABSTRACT FACTORY See abstract factory code example
  • 20. SESSION RESOURCES • Presentation session notes including link to this session, will be available on http://learningaboutfudge.blogspot.com • All the source for this session is publically available at: https://github.com/SheepWorx/Training • RSS Feed: http://learningaboutfudge.blogspot.com/feeds/posts/default?alt=rss • Local Network: dmeyer-msharetrainingCode Like a Ninja • Source was compiled using Visual Studio 2012 • http://www.gofpatterns.com/

Editor's Notes

  1. Basic srpExposeutils class antipatternExpose singleton as a bad pattern to use (use at own risk)