Lecture #4
       Ahmed Safwat
   Muhamad Hesham
Abdelrahman Al-Ogail
   What about Singleton?
   Call for a new requirement.
   First try implementation.
   Meet today’s pattern.
   Second try implementation.
   Common uses.
   Project Description.
   What’s after all of this?
What have we did
   till now?
You: Dad, I need pocket money.
Dad: *^^%^&@&**&^#&*%&*#%
Design Patterns Summer Course 2009-2010 - Session#4
Design Patterns Summer Course 2009-2010 - Session#4
sign in
Offline                             Available




                 available                                  busy

                             away
                                             available


                                      away
          Away                                                     Busy


                                     busy

                                                         All states are connected
                                                          to offline via sign out
Design Patterns Summer Course 2009-2010 - Session#4
Out of                                    No
 Pepsi                                    Money

                                                      insert
                    pepsi > 0                         money
                                              eject
pepsi = 0
                                              money



            Pepsi                                      Has
            Sold                                      Money
                                order pepsi
reach cliff




          after a while
Running                   Idle
   I want the enemy turn
    crazy when you collect a
    gem.
   If you touch the enemy
    while it is crazy, you die
    and it turns idle again.
   Double crazy enemy
    speed by 4 times once.
reach cliff




                 after a while
Running                                Idle
                            gem
       gem                collected
     collected

                                 player died


                    Crazy
What do you think we need do
          this time ?
   Violates Open Closed
    Princible.
   Not object oriented.
   Further additions will
    cause bugs.
   State transitions are
    buried between if-else.
Exploring the pattern   Let’s Google it!
Design Patterns Summer Course 2009-2010 - Session#4
Explaining the pattern   Pattern class diagram
Design Patterns Summer Course 2009-2010 - Session#4
Pac-Man
Keyboard with Shift Key
Windows Live Mail (Offline/Online)
Pattern’s Challenge   Try it yourself


     Strategy/State conflict
     Challenge:

  What are the differences between State and
               Strategy Pattern?
What’s Next       Further Reading

    State Pattern: Chapter 10 in Head First
    Strategy Pattern: Chapter 1 in Head First
    GoF: Behavioral Pattern Section
    Section: enhance way of drawing shapes
Questions??
mhesham.fcis@gmail.com
 Zikas_zak@hotmail.com

More Related Content

PDF
Product Management Portfolio
KEY
Keynote for eco house
PDF
Design Patterns Summer Course 2009-2010 - Session#1
DOC
RAVI_CV
PPT
On writing well
PDF
Design Patterns Summer Course 2009-2010 - Session#2
PPTX
Design Patterns Summer Course 2010-2011 - Session#2
PPTX
Design Patterns Summer Course 2010-2011 - Session#1
Product Management Portfolio
Keynote for eco house
Design Patterns Summer Course 2009-2010 - Session#1
RAVI_CV
On writing well
Design Patterns Summer Course 2009-2010 - Session#2
Design Patterns Summer Course 2010-2011 - Session#2
Design Patterns Summer Course 2010-2011 - Session#1

Viewers also liked (6)

PPTX
Design Patterns Summer Course 2009-2010 - Session#3
PPTX
[K Engine] Intorduction To Machine Planning, A Case Based Approach
PDF
Smart leaven technologies_corporate_presentation_short_4
PPTX
NTP Software Jan 2012 Monthly Meeting IPC Presentation
PPTX
1st Seminar- Intelligent Agent for Medium-Level Artificial Intelligence in Re...
PPT
On writing well
Design Patterns Summer Course 2009-2010 - Session#3
[K Engine] Intorduction To Machine Planning, A Case Based Approach
Smart leaven technologies_corporate_presentation_short_4
NTP Software Jan 2012 Monthly Meeting IPC Presentation
1st Seminar- Intelligent Agent for Medium-Level Artificial Intelligence in Re...
On writing well
Ad

Similar to Design Patterns Summer Course 2009-2010 - Session#4 (6)

PDF
WorldSC Smartphones Applications Portfolio
PPTX
Lean Game Development
PPTX
Funza Games Presentation
PDF
Funza Games Presentation
PPT
Web design 3
PPTX
3RD SENSE Pokemon Go Seminar
WorldSC Smartphones Applications Portfolio
Lean Game Development
Funza Games Presentation
Funza Games Presentation
Web design 3
3RD SENSE Pokemon Go Seminar
Ad

Recently uploaded (20)

PDF
Unlock new opportunities with location data.pdf
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
DOCX
search engine optimization ppt fir known well about this
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
August Patch Tuesday
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Five Habits of High-Impact Board Members
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PPTX
The various Industrial Revolutions .pptx
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPT
Geologic Time for studying geology for geologist
Unlock new opportunities with location data.pdf
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Getting started with AI Agents and Multi-Agent Systems
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Assigned Numbers - 2025 - Bluetooth® Document
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Taming the Chaos: How to Turn Unstructured Data into Decisions
search engine optimization ppt fir known well about this
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
August Patch Tuesday
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Five Habits of High-Impact Board Members
A contest of sentiment analysis: k-nearest neighbor versus neural network
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
The various Industrial Revolutions .pptx
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
A novel scalable deep ensemble learning framework for big data classification...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Geologic Time for studying geology for geologist

Design Patterns Summer Course 2009-2010 - Session#4

  • 1. Lecture #4 Ahmed Safwat Muhamad Hesham Abdelrahman Al-Ogail
  • 2. What about Singleton?  Call for a new requirement.  First try implementation.  Meet today’s pattern.  Second try implementation.  Common uses.  Project Description.  What’s after all of this?
  • 3. What have we did till now?
  • 4. You: Dad, I need pocket money. Dad: *^^%^&@&**&^#&*%&*#%
  • 7. sign in Offline Available available busy away available away Away Busy busy All states are connected to offline via sign out
  • 9. Out of No Pepsi Money insert pepsi > 0 money eject pepsi = 0 money Pepsi Has Sold Money order pepsi
  • 10. reach cliff after a while Running Idle
  • 11. I want the enemy turn crazy when you collect a gem.  If you touch the enemy while it is crazy, you die and it turns idle again.  Double crazy enemy speed by 4 times once.
  • 12. reach cliff after a while Running Idle gem gem collected collected player died Crazy
  • 13. What do you think we need do this time ?
  • 14. Violates Open Closed Princible.  Not object oriented.  Further additions will cause bugs.  State transitions are buried between if-else.
  • 15. Exploring the pattern Let’s Google it!
  • 17. Explaining the pattern Pattern class diagram
  • 21. Windows Live Mail (Offline/Online)
  • 22. Pattern’s Challenge Try it yourself  Strategy/State conflict  Challenge: What are the differences between State and Strategy Pattern?
  • 23. What’s Next Further Reading  State Pattern: Chapter 10 in Head First  Strategy Pattern: Chapter 1 in Head First  GoF: Behavioral Pattern Section  Section: enhance way of drawing shapes