Lecture 5b Basic Design Patterns

Lecture 5b Basic Design Patterns - Lecture5b:BasicDesign...

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 5b: Basic Design  Patterns CSE 111
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Basic Design Patterns We know our subsystem interface classes  and (some of) their methods We need to create classes in our  subsystems, and assign responsibilities to  those classes There were many ways of doing this, how  do we know whether we are making a  good choice? 01/08/11 Copyright W. Howden 2
Image of page 2
Copyright W. Howden 3 Basic Design Patterns  Expert Which class gets which responsibilities Creator Which object creates other objects Controller Which class instance(s) detects events,  creates class instances to handle the events if  necessary, and calls on appropriate  class/object methods  01/08/11
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Copyright W. Howden 4 Expert Pattern Assign the responsibility to the class that  has the information necessary to fulfill  those responsibilities Related principle Object animation : Take the things that you  would normally do to an object and have it do  it itself 01/08/11
Image of page 4
DateRequest Object  Animation  Assume that the parameters userName and  daterPrefs are what is needed to find a date Instead of calling a procedure, say  FindDate(), that takes these parameters and  looks for a date, we design a DateRequest  class that stores this information.  We give  the responsibility of finding dates to the  DateRequest class because it has the  information needed to do this We design DateRequest with a method  execute() which causes it to use its  information to find dates 01/08/11 Copyright W. Howden 5
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Copyright W. Howden
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern