SlideShare una empresa de Scribd logo
1 de 8
QmPe
                                                   initiative




ABSTRACT FACTORY PATTERN explained !




                                    Prepared by Annamalai C


              Copyright 2006-2011
Abstract Factory Pattern in Real Life
Abstract Factory Pattern is similar to Sub Contracting in real world.
Basically delegating the creation of Objects to expert Factories
-----------------------------------
Orders in a restaurant are received by a Kitchen.
Then are assigned to Special Chefs like
Chinese, Indian, Continental.




Abstract Factory Pattern is a Creational Pattern.
Similar to Factory Pattern it is Object Creation without exposing “HOW” ?




                                    Copyright 2006-2011
Abstract Factory Pattern in Java




                              Copyright 2006-2011
Real Life vs Java Object



                                                 Factory




                                                 Kitchen




                           Copyright 2006-2011
Real Life vs Java Object




                           Copyright 2006-2011
How Factory Pattern works in Real Life ?


               1   Orders a Dish from Menu




                                                             Receives the Order
                                                      2      Creates the Dish


                                                                                  3   Outsources to Chef
               4   Delivers the Dish




                                       Copyright 2006-2011
How Factory Pattern works in Java ?

                                                               public Food getFood(String name) {
                                                                 if (name.equals("Dosa")) {
                                                                   IndianFactory factory = new IndianFactory();
                   1                                               return factory.getFood(name);
                                                               } else if (name.equals("Noodles")) {
                                                                 ChineseFactory factory = new
                                                               ChineseFactory();
                                                                 return factory.getFood(name);
                                                               }
KitchenFactory factory = new KitchenFactory();                 Return null;}
Food dosa = factory.getFood("Dosa");                                              2
dosa.print();
                                                            Create food from Respective Factory Class
Food noodles = factory.getFood("Noodles");
noodles.print();

                                                                                  3

                                                                           Food

                  4
                                                                   Dosa           Noodles



                                             Copyright 2006-2011
THANK YOU


                   Please visit
www.eclipseinclips.com | www.ancitconsulting.com

     Write to us on info@ancitconsulting.com




                  QmPe
                  initiative


                   Copyright 2006-2011

Más contenido relacionado

Más de Annamalai Chockalingam

Más de Annamalai Chockalingam (8)

Hello World e4 Application Part 3
Hello World e4 Application  Part 3Hello World e4 Application  Part 3
Hello World e4 Application Part 3
 
Design patterns - Strategy Pattern
Design patterns - Strategy PatternDesign patterns - Strategy Pattern
Design patterns - Strategy Pattern
 
Design patterns - Observer Pattern
Design patterns - Observer PatternDesign patterns - Observer Pattern
Design patterns - Observer Pattern
 
Design patterns - Decorator pattern
Design patterns -   Decorator patternDesign patterns -   Decorator pattern
Design patterns - Decorator pattern
 
Design patterns - Adapter Pattern
Design patterns - Adapter PatternDesign patterns - Adapter Pattern
Design patterns - Adapter Pattern
 
Eclipse Spykit Project
Eclipse Spykit ProjectEclipse Spykit Project
Eclipse Spykit Project
 
Setting up Sphinx Development Environment
Setting up Sphinx Development EnvironmentSetting up Sphinx Development Environment
Setting up Sphinx Development Environment
 
Eclipse Ecosystem in India
Eclipse Ecosystem in IndiaEclipse Ecosystem in India
Eclipse Ecosystem in India
 

Último

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Último (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

Design patterns - Abstract Factory Pattern

  • 1. QmPe initiative ABSTRACT FACTORY PATTERN explained ! Prepared by Annamalai C Copyright 2006-2011
  • 2. Abstract Factory Pattern in Real Life Abstract Factory Pattern is similar to Sub Contracting in real world. Basically delegating the creation of Objects to expert Factories ----------------------------------- Orders in a restaurant are received by a Kitchen. Then are assigned to Special Chefs like Chinese, Indian, Continental. Abstract Factory Pattern is a Creational Pattern. Similar to Factory Pattern it is Object Creation without exposing “HOW” ? Copyright 2006-2011
  • 3. Abstract Factory Pattern in Java Copyright 2006-2011
  • 4. Real Life vs Java Object Factory Kitchen Copyright 2006-2011
  • 5. Real Life vs Java Object Copyright 2006-2011
  • 6. How Factory Pattern works in Real Life ? 1 Orders a Dish from Menu Receives the Order 2 Creates the Dish 3 Outsources to Chef 4 Delivers the Dish Copyright 2006-2011
  • 7. How Factory Pattern works in Java ? public Food getFood(String name) { if (name.equals("Dosa")) { IndianFactory factory = new IndianFactory(); 1 return factory.getFood(name); } else if (name.equals("Noodles")) { ChineseFactory factory = new ChineseFactory(); return factory.getFood(name); } KitchenFactory factory = new KitchenFactory(); Return null;} Food dosa = factory.getFood("Dosa"); 2 dosa.print(); Create food from Respective Factory Class Food noodles = factory.getFood("Noodles"); noodles.print(); 3 Food 4 Dosa Noodles Copyright 2006-2011
  • 8. THANK YOU Please visit www.eclipseinclips.com | www.ancitconsulting.com Write to us on info@ancitconsulting.com QmPe initiative Copyright 2006-2011