際際滷

際際滷Share a Scribd company logo
Lets break the ice.Lecture # 3Ahmed SafwatMuhamadHeshamAbdelrahman Al-Ogail
AgendaYou can solve it yourself!Meet Singleton pattern.Call for a new requirement.First try for implementation.Bad smell code.Whos our hero?
Agenda (cont)Meet  todays pattern.Break!!Second try for implementation.Common uses.Whats next?
Whats a design pattern?A design pattern is:Set of class(es).Interact together.In UML (class diagram).Informal
Lets solve it ourselvesHow do we ensure that a class has only one instance and that the instance is easily accessible?UniqueGlobal Access
SingletonFormalThe Singleton assures that there is one and only one instance of a class, and provides a global point of access to itMake sure that there can be one and only one instance of a class
Singleton
Our Current StatusWhat have we did till now?
Call for New RequirementEach level can be in one of two styles:PharonicAztecFirst level is Aztec.Second and third level is Pharonic.
First Try Implementation1. We need find where we decide which image we load.2. Categorize images to 2 sets, Pharonic an Aztec.
Our Code Smells BadEach time we add a new theme we add piles of if-elsestatements.Our class do more than its job (SCSR).
My Restaurant Drinks
My Restaurant Drinks
My Restaurant DrinksWater BottleCoke softOrange softLemon soft
Whos our hero?So, what we can call it?
Lets Google it!
Break
Meet Abstract Factory
Meet Abstract FactoryLemon softCoke soft
Second Try for ImplementationJust Code It
Common Uses
Whats Next?Consequences of Factory Pattern.Factory Method Pattern.Implement Factory Pattern using Prototype Pattern.
Thank you ...Questions??ahmedaliyossef@acm.orgmhesham.fcis@gmail.comzikas_zak@hotmail.com
Ad

Recommended

RAVI_CV
RAVI_CV
Ravi Cheerath
Design Patterns Summer Course 2009-2010 - Session#4
Design Patterns Summer Course 2009-2010 - Session#4
Muhamad Hesham
Product Management Portfolio
Product Management Portfolio
Steve Orme
On writing well
On writing well
irepdaronx
Design Patterns Summer Course 2010-2011 - Session#1
Design Patterns Summer Course 2010-2011 - Session#1
Muhamad Hesham
Design Patterns Summer Course 2009-2010 - Session#1
Design Patterns Summer Course 2009-2010 - Session#1
Muhamad Hesham
Design Patterns Summer Course 2010-2011 - Session#2
Design Patterns Summer Course 2010-2011 - Session#2
Muhamad Hesham
Design Patterns Summer Course 2009-2010 - Session#2
Design Patterns Summer Course 2009-2010 - Session#2
Muhamad Hesham
Keynote for eco house
Keynote for eco house
eleanorhealy
Smart leaven technologies_corporate_presentation_short_4
Smart leaven technologies_corporate_presentation_short_4
Ganesh Shevade
[K Engine] Intorduction To Machine Planning, A Case Based Approach
[K Engine] Intorduction To Machine Planning, A Case Based Approach
Muhamad Hesham
NTP Software Jan 2012 Monthly Meeting IPC Presentation
NTP Software Jan 2012 Monthly Meeting IPC Presentation
Muhamad Hesham
1st Seminar- Intelligent Agent for Medium-Level Artificial Intelligence in Re...
1st Seminar- Intelligent Agent for Medium-Level Artificial Intelligence in Re...
Muhamad Hesham
On writing well
On writing well
irepdaronx
What is design pattern
What is design pattern
Md.Shohel Rana ( M.Sc in CSE Khulna University of Engineering & Technology (KUET))
Singleton Pattern (Sole Object with Global Access)
Singleton Pattern (Sole Object with Global Access)
Sameer Rathoud
Advanced Introduction to Java Multi-Threading - Full (chok)
Advanced Introduction to Java Multi-Threading - Full (chok)
choksheak
Core java interview questions1
Core java interview questions1
Lahari Reddy
OOPs difference faqs- 2
OOPs difference faqs- 2
Umar Ali
Unusual C# - OOP
Unusual C# - OOP
Medhat Dawoud
25 java tough interview questions
25 java tough interview questions
Arun Banotra
EESTEC Android Workshops - 101 Java, OOP and Introduction to Android
EESTEC Android Workshops - 101 Java, OOP and Introduction to Android
Antonis Kalipetis
Introduction to Design Patterns
Introduction to Design Patterns
Prageeth Sandakalum
Review oop and ood
Review oop and ood
than sare
Design patterns
Design patterns
Prawesh Shrestha
Inheritance in java.ppt
Inheritance in java.ppt
SeethaDinesh
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
mikaelbarbero
Threading in C#
Threading in C#
Medhat Dawoud
Profiling JavaScript Performance
Profiling JavaScript Performance
Noam Kfir
Java Threads
Java Threads
Hamid Ghorbani

More Related Content

Viewers also liked (6)

Keynote for eco house
Keynote for eco house
eleanorhealy
Smart leaven technologies_corporate_presentation_short_4
Smart leaven technologies_corporate_presentation_short_4
Ganesh Shevade
[K Engine] Intorduction To Machine Planning, A Case Based Approach
[K Engine] Intorduction To Machine Planning, A Case Based Approach
Muhamad Hesham
NTP Software Jan 2012 Monthly Meeting IPC Presentation
NTP Software Jan 2012 Monthly Meeting IPC Presentation
Muhamad Hesham
1st Seminar- Intelligent Agent for Medium-Level Artificial Intelligence in Re...
1st Seminar- Intelligent Agent for Medium-Level Artificial Intelligence in Re...
Muhamad Hesham
On writing well
On writing well
irepdaronx
Keynote for eco house
Keynote for eco house
eleanorhealy
Smart leaven technologies_corporate_presentation_short_4
Smart leaven technologies_corporate_presentation_short_4
Ganesh Shevade
[K Engine] Intorduction To Machine Planning, A Case Based Approach
[K Engine] Intorduction To Machine Planning, A Case Based Approach
Muhamad Hesham
NTP Software Jan 2012 Monthly Meeting IPC Presentation
NTP Software Jan 2012 Monthly Meeting IPC Presentation
Muhamad Hesham
1st Seminar- Intelligent Agent for Medium-Level Artificial Intelligence in Re...
1st Seminar- Intelligent Agent for Medium-Level Artificial Intelligence in Re...
Muhamad Hesham
On writing well
On writing well
irepdaronx

Similar to Design Patterns Summer Course 2009-2010 - Session#3 (20)

What is design pattern
What is design pattern
Md.Shohel Rana ( M.Sc in CSE Khulna University of Engineering & Technology (KUET))
Singleton Pattern (Sole Object with Global Access)
Singleton Pattern (Sole Object with Global Access)
Sameer Rathoud
Advanced Introduction to Java Multi-Threading - Full (chok)
Advanced Introduction to Java Multi-Threading - Full (chok)
choksheak
Core java interview questions1
Core java interview questions1
Lahari Reddy
OOPs difference faqs- 2
OOPs difference faqs- 2
Umar Ali
Unusual C# - OOP
Unusual C# - OOP
Medhat Dawoud
25 java tough interview questions
25 java tough interview questions
Arun Banotra
EESTEC Android Workshops - 101 Java, OOP and Introduction to Android
EESTEC Android Workshops - 101 Java, OOP and Introduction to Android
Antonis Kalipetis
Introduction to Design Patterns
Introduction to Design Patterns
Prageeth Sandakalum
Review oop and ood
Review oop and ood
than sare
Design patterns
Design patterns
Prawesh Shrestha
Inheritance in java.ppt
Inheritance in java.ppt
SeethaDinesh
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
mikaelbarbero
Threading in C#
Threading in C#
Medhat Dawoud
Profiling JavaScript Performance
Profiling JavaScript Performance
Noam Kfir
Java Threads
Java Threads
Hamid Ghorbani
HPAI Class 2 - human aspects and computing systems in ai - 012920
HPAI Class 2 - human aspects and computing systems in ai - 012920
melendez321
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Ayes Chinmay
04 inheritance
04 inheritance
Pondugala Sowjanya
Design Patterns- Course for students .pptx
Design Patterns- Course for students .pptx
khaledmohamedadelkam
Singleton Pattern (Sole Object with Global Access)
Singleton Pattern (Sole Object with Global Access)
Sameer Rathoud
Advanced Introduction to Java Multi-Threading - Full (chok)
Advanced Introduction to Java Multi-Threading - Full (chok)
choksheak
Core java interview questions1
Core java interview questions1
Lahari Reddy
OOPs difference faqs- 2
OOPs difference faqs- 2
Umar Ali
25 java tough interview questions
25 java tough interview questions
Arun Banotra
EESTEC Android Workshops - 101 Java, OOP and Introduction to Android
EESTEC Android Workshops - 101 Java, OOP and Introduction to Android
Antonis Kalipetis
Introduction to Design Patterns
Introduction to Design Patterns
Prageeth Sandakalum
Review oop and ood
Review oop and ood
than sare
Inheritance in java.ppt
Inheritance in java.ppt
SeethaDinesh
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
mikaelbarbero
Profiling JavaScript Performance
Profiling JavaScript Performance
Noam Kfir
HPAI Class 2 - human aspects and computing systems in ai - 012920
HPAI Class 2 - human aspects and computing systems in ai - 012920
melendez321
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Ayes Chinmay
Design Patterns- Course for students .pptx
Design Patterns- Course for students .pptx
khaledmohamedadelkam
Ad

Recently uploaded (20)

OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
June Patch Tuesday
June Patch Tuesday
Ivanti
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
June Patch Tuesday
June Patch Tuesday
Ivanti
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
Ad

Design Patterns Summer Course 2009-2010 - Session#3