際際滷

際際滷Share a Scribd company logo
Lecture # 2
        Ahmed Safwat
Abdelrahman Z. Al-Ogail
     Muhamad Hesham
   Call for a new requirement.
   First try for implementation.
   Bad smell code.
   Meet observer pattern.
   Pattern class diagram.
   Second try for implementation.(developing
    pattern in C#).
   Common uses.
   Whats next? (Further reading).
Call for new requirement


    Once the player collects a
     gem I want:
      Enemy increases its speed.
      Other gems change its color
      to a random color.
First try for implementation



1. We need find the place in code where
the gem is tested for being collected.

2. We need modify enemy speed.
3. We need modify gem color.
Our code smells bad!


   What bad things we did ?
    1. We expose private
     members to the public.

    2. We are dependant on
     certain members.

    3. Each time we need modify
     the level code.
Real life example




Do you know how news paper
     subscribtion work ?
Publisher + Subscriber




Publisher




   Not notified
                                           Subscribers
Publisher + Subscriber




Publisher




                Subscribe



                                     Subscribers
Publisher + Subscriber




Publisher




                                     Subscribers
Publisher + Subscriber




                                         I am not
Publisher                               interested
                                         anymore




                                     Subscribers
Publisher + Subscriber




Publisher




   Not notified
                                           Subscribers
Discovering Pattern   Lets Google it!
Explaining the Pattern   See how its easy!
Class Diagram   Source: GoFs Book
Implementation    Developing the pattern in C#


     See how we develop a pattern!
Call for new requirement


    Once the player die I want:
      Enemies speed is reset.
      Other gems change its color
      to black.
Just pattern it



1. We need find the place in code where
the gem is player is tested for being dead.

2. We need reset enemy speed.
3. We need modify color gem with
black.
Common Uses        Source: GoFs Book


    Spreadsheets, Bar Graph and Pie Graph
     presentations of the same data.
    Chat Windows in IMs.
    RSS and News-feed.
    In Smalltalk programming language MVC
      Model: subject
      View: observers
Whats Next?              Wait a minute! What about the rest


     Patterns explanation in GoF
       Pattern Name and Classification: A descriptive and unique name that
        helps in identifying and referring to the pattern
       Intent: A description of the goal behind the pattern and the reason for
        using it.
       Also Known As: Other names for the pattern
       Motivation (Forces): A scenario consisting of a problem and a context
        in which this pattern can be used.
Whats Next?              Wait a minute! What about the rest


     Patterns explanation in GoF
       Consequences: A description of the results, side effects, and trade offs
        caused by using the pattern.
       Sample Code: An illustration of how the pattern can be used in a
        programming language
       Known Uses: Examples of real usages of the pattern.
       Related Patterns: Other patterns that have some relationship with the
        pattern; discussion of the differences between the pattern and similar
        patterns
Whats Next?          Not Covered points


     Design Advantages of using this pattern:
       Objects are loosely coupled.
       Adding new observers at any time without effort.
       Changes in subject or observer dont effect the other
It is about times


   How they attended Lessons?
   How they managed their time?
     Reading while eating & walking
     Eating Ka`ak
   Results:
     Bagdad Library
     Saheb Abn Abbad`s Library
       Lon Gorand talking about his books 400 Hajri.
Whats Next       Books to read


     Head First  Design Patterns: Chapter # 2
     GoF  Behavioral Patterns Section
Questions??
ahmedaliyousif@acm.org
Mhesham.fcis@gmail.com
 Zikas_zak@hotmail.com
Ad

Recommended

Product Management Portfolio
Product Management Portfolio
Steve Orme
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
Design Patterns.ppt
Design Patterns.ppt
TanishaKochak
Design Patterns .Net
Design Patterns .Net
Hariom Shah
12266422.ppt
12266422.ppt
CSEC5
Design Patterns Summer Course 2009-2010 - Session#1
Design Patterns Summer Course 2009-2010 - Session#1
Muhamad Hesham
Design patterns
Design patterns
nisheesh
Software design and Architecture.pptx
Software design and Architecture.pptx
SHAHZAIBABBAS13
Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018
David Litvak Bruno
Design Patterns- Course for students .pptx
Design Patterns- Course for students .pptx
khaledmohamedadelkam
Design pattern
Design pattern
UT, San Antonio
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
Anil Sharma
Introduction to design patterns
Introduction to design patterns
Amit Kabra
Introduction to Design Pattern
Introduction to Design Pattern
Sanae BEKKAR
Some Cool Design Patterns, Practices, and Principles
Some Cool Design Patterns, Practices, and Principles
itsarsalan
Design pattern of software words computer .pptx
Design pattern of software words computer .pptx
muslimpari2503
design pattern is the computer scicence subject
design pattern is the computer scicence subject
vamsikrishna76598838
L05 Design Patterns
L05 Design Patterns
lafur Andri Ragnarsson
Oops design pattern_amitgupta
Oops design pattern_amitgupta
Amit Gupta, MCSD TOGAF
DesignPattern-Overview.pptx
DesignPattern-Overview.pptx
Mohit750936
Essential java script design patterns
Essential java script design patterns
gaiashare
Women Who Code Belfast: Introduction to Design patterns
Women Who Code Belfast: Introduction to Design patterns
Jackie Pollock
Let us understand design pattern
Let us understand design pattern
Mindfire Solutions
Classification of Design Pattern by Ravi Patki
Classification of Design Pattern by Ravi Patki
Ravi Patki
Design Patterns
Design Patterns
Sergii Stets
(E book pdf) thinking in patterns with java
(E book pdf) thinking in patterns with java
Raffaella D'angelo
NTP Software Jan 2012 Monthly Meeting IPC Presentation
NTP Software Jan 2012 Monthly Meeting IPC Presentation
Muhamad Hesham
Design Patterns Summer Course 2009-2010 - Session#4
Design Patterns Summer Course 2009-2010 - Session#4
Muhamad Hesham

More Related Content

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

Design patterns
Design patterns
nisheesh
Software design and Architecture.pptx
Software design and Architecture.pptx
SHAHZAIBABBAS13
Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018
David Litvak Bruno
Design Patterns- Course for students .pptx
Design Patterns- Course for students .pptx
khaledmohamedadelkam
Design pattern
Design pattern
UT, San Antonio
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
Anil Sharma
Introduction to design patterns
Introduction to design patterns
Amit Kabra
Introduction to Design Pattern
Introduction to Design Pattern
Sanae BEKKAR
Some Cool Design Patterns, Practices, and Principles
Some Cool Design Patterns, Practices, and Principles
itsarsalan
Design pattern of software words computer .pptx
Design pattern of software words computer .pptx
muslimpari2503
design pattern is the computer scicence subject
design pattern is the computer scicence subject
vamsikrishna76598838
L05 Design Patterns
L05 Design Patterns
lafur Andri Ragnarsson
Oops design pattern_amitgupta
Oops design pattern_amitgupta
Amit Gupta, MCSD TOGAF
DesignPattern-Overview.pptx
DesignPattern-Overview.pptx
Mohit750936
Essential java script design patterns
Essential java script design patterns
gaiashare
Women Who Code Belfast: Introduction to Design patterns
Women Who Code Belfast: Introduction to Design patterns
Jackie Pollock
Let us understand design pattern
Let us understand design pattern
Mindfire Solutions
Classification of Design Pattern by Ravi Patki
Classification of Design Pattern by Ravi Patki
Ravi Patki
Design Patterns
Design Patterns
Sergii Stets
(E book pdf) thinking in patterns with java
(E book pdf) thinking in patterns with java
Raffaella D'angelo
Design patterns
Design patterns
nisheesh
Software design and Architecture.pptx
Software design and Architecture.pptx
SHAHZAIBABBAS13
Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018
David Litvak Bruno
Design Patterns- Course for students .pptx
Design Patterns- Course for students .pptx
khaledmohamedadelkam
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
Anil Sharma
Introduction to design patterns
Introduction to design patterns
Amit Kabra
Introduction to Design Pattern
Introduction to Design Pattern
Sanae BEKKAR
Some Cool Design Patterns, Practices, and Principles
Some Cool Design Patterns, Practices, and Principles
itsarsalan
Design pattern of software words computer .pptx
Design pattern of software words computer .pptx
muslimpari2503
design pattern is the computer scicence subject
design pattern is the computer scicence subject
vamsikrishna76598838
DesignPattern-Overview.pptx
DesignPattern-Overview.pptx
Mohit750936
Essential java script design patterns
Essential java script design patterns
gaiashare
Women Who Code Belfast: Introduction to Design patterns
Women Who Code Belfast: Introduction to Design patterns
Jackie Pollock
Let us understand design pattern
Let us understand design pattern
Mindfire Solutions
Classification of Design Pattern by Ravi Patki
Classification of Design Pattern by Ravi Patki
Ravi Patki
Design Patterns
Design Patterns
Sergii Stets
(E book pdf) thinking in patterns with java
(E book pdf) thinking in patterns with java
Raffaella D'angelo

More from Muhamad Hesham (7)

NTP Software Jan 2012 Monthly Meeting IPC Presentation
NTP Software Jan 2012 Monthly Meeting IPC Presentation
Muhamad Hesham
Design Patterns Summer Course 2009-2010 - Session#4
Design Patterns Summer Course 2009-2010 - Session#4
Muhamad Hesham
Design Patterns Summer Course 2009-2010 - Session#3
Design Patterns Summer Course 2009-2010 - Session#3
Muhamad Hesham
Design Patterns Summer Course 2010-2011 - Session#1
Design Patterns Summer Course 2010-2011 - Session#1
Muhamad Hesham
Design Patterns Summer Course 2010-2011 - Session#2
Design Patterns Summer Course 2010-2011 - Session#2
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
[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
Design Patterns Summer Course 2009-2010 - Session#4
Design Patterns Summer Course 2009-2010 - Session#4
Muhamad Hesham
Design Patterns Summer Course 2009-2010 - Session#3
Design Patterns Summer Course 2009-2010 - Session#3
Muhamad Hesham
Design Patterns Summer Course 2010-2011 - Session#1
Design Patterns Summer Course 2010-2011 - Session#1
Muhamad Hesham
Design Patterns Summer Course 2010-2011 - Session#2
Design Patterns Summer Course 2010-2011 - Session#2
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
[K Engine] Intorduction To Machine Planning, A Case Based Approach
[K Engine] Intorduction To Machine Planning, A Case Based Approach
Muhamad Hesham
Ad

Recently uploaded (20)

Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
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
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 Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
Wenn alles versagt - IBM Tape sch端tzt, was z辰hlt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape sch端tzt, was z辰hlt! Und besonders mit dem neust...
Josef Weingand
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
Safe Software
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
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Key Requirements to Successfully Implement Generative AI in Edge DevicesOpt...
Key Requirements to Successfully Implement Generative AI in Edge DevicesOpt...
Edge AI and Vision Alliance
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
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
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
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 Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
Wenn alles versagt - IBM Tape sch端tzt, was z辰hlt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape sch端tzt, was z辰hlt! Und besonders mit dem neust...
Josef Weingand
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
Safe Software
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
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Key Requirements to Successfully Implement Generative AI in Edge DevicesOpt...
Key Requirements to Successfully Implement Generative AI in Edge DevicesOpt...
Edge AI and Vision Alliance
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
Ad

Design Patterns Summer Course 2009-2010 - Session#2

  • 1. Lecture # 2 Ahmed Safwat Abdelrahman Z. Al-Ogail Muhamad Hesham
  • 2. Call for a new requirement. First try for implementation. Bad smell code. Meet observer pattern. Pattern class diagram. Second try for implementation.(developing pattern in C#). Common uses. Whats next? (Further reading).
  • 3. Call for new requirement Once the player collects a gem I want: Enemy increases its speed. Other gems change its color to a random color.
  • 4. First try for implementation 1. We need find the place in code where the gem is tested for being collected. 2. We need modify enemy speed. 3. We need modify gem color.
  • 5. Our code smells bad! What bad things we did ? 1. We expose private members to the public. 2. We are dependant on certain members. 3. Each time we need modify the level code.
  • 6. Real life example Do you know how news paper subscribtion work ?
  • 7. Publisher + Subscriber Publisher Not notified Subscribers
  • 8. Publisher + Subscriber Publisher Subscribe Subscribers
  • 10. Publisher + Subscriber I am not Publisher interested anymore Subscribers
  • 11. Publisher + Subscriber Publisher Not notified Subscribers
  • 12. Discovering Pattern Lets Google it!
  • 13. Explaining the Pattern See how its easy!
  • 14. Class Diagram Source: GoFs Book
  • 15. Implementation Developing the pattern in C# See how we develop a pattern!
  • 16. Call for new requirement Once the player die I want: Enemies speed is reset. Other gems change its color to black.
  • 17. Just pattern it 1. We need find the place in code where the gem is player is tested for being dead. 2. We need reset enemy speed. 3. We need modify color gem with black.
  • 18. Common Uses Source: GoFs Book Spreadsheets, Bar Graph and Pie Graph presentations of the same data. Chat Windows in IMs. RSS and News-feed. In Smalltalk programming language MVC Model: subject View: observers
  • 19. Whats Next? Wait a minute! What about the rest Patterns explanation in GoF Pattern Name and Classification: A descriptive and unique name that helps in identifying and referring to the pattern Intent: A description of the goal behind the pattern and the reason for using it. Also Known As: Other names for the pattern Motivation (Forces): A scenario consisting of a problem and a context in which this pattern can be used.
  • 20. Whats Next? Wait a minute! What about the rest Patterns explanation in GoF Consequences: A description of the results, side effects, and trade offs caused by using the pattern. Sample Code: An illustration of how the pattern can be used in a programming language Known Uses: Examples of real usages of the pattern. Related Patterns: Other patterns that have some relationship with the pattern; discussion of the differences between the pattern and similar patterns
  • 21. Whats Next? Not Covered points Design Advantages of using this pattern: Objects are loosely coupled. Adding new observers at any time without effort. Changes in subject or observer dont effect the other
  • 22. It is about times How they attended Lessons? How they managed their time? Reading while eating & walking Eating Ka`ak Results: Bagdad Library Saheb Abn Abbad`s Library Lon Gorand talking about his books 400 Hajri.
  • 23. Whats Next Books to read Head First Design Patterns: Chapter # 2 GoF Behavioral Patterns Section