jagomart
digital resources
picture1_Bbm486 Slide 3


 121x       Filetype PDF       File size 1.01 MB       Source: yunus.hacettepe.edu.tr


File: Bbm486 Slide 3
design patterns strategy pattern how to design for flexibility ebru hacettepe edu tr ebruakcapinarsezer gmail com http yunus hacettepe edu tr ebru ebru176 ekim 2017 revised from www uwosh edu ...

icon picture PDF Filetype PDF | Posted on 04 Feb 2023 | 2 years ago
Partial capture of text on file.
                          Design Patterns
                         Strategy Pattern*
                         How to design for flexibility?
                        ebru@hacettepe.edu.tr
                     ebruakcapinarsezer@gmail.com
                   http://yunus.hacettepe.edu.tr/~ebru/
                             @ebru176
                             Ekim 2017
               *revised from, www.uwosh.edu/faculty_staff/huen/262/f09/slides/10_Strategy_Pattern.ppt
 Existing Duck application
     All ducks quack        Duck
     and swim.  The 
     superclass takes       quack()
     care of the            swim()
     implementation                                              The display() 
     code                   display()                            method is abstract, 
                            //other duck-like methods…           since all duck 
    Each duck subtype is                                         subtypes look 
    responsible for                                              different
    implementing its own 
    display() method
                                                                         Other duck 
          MallardDuck                     RedHeadDuck                    types inherit 
                                          display() {                    from the 
          display() {                                                    Duck class
          // looks like a mallard}        // looks like a redhead }      . . . 
  Testing Mallard, RedHeadDuck classes
  Changing Requirment
    • No sweat!
      • Add a method fly() in Duck
      • Continue to use inheritance
The words contained in this file might help you see if this file matches what you are looking for:

...Design patterns strategy pattern how to for flexibility ebru hacettepe edu tr ebruakcapinarsezer gmail com http yunus ekim revised from www uwosh faculty staff huen f slides ppt existing duck application all ducks quack and swim the superclass takes care of implementation display code method is abstract other like methods since each subtype subtypes look responsible different implementing its own mallardduck redheadduck types inherit class looks a mallard redhead testing classes changing requirment no sweat add fly in continue use inheritance...

no reviews yet
Please Login to review.