Lecture 5b Basic Design Patterns

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

Info iconThis preview shows pages 1–6. Sign up to view the full content.

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

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

View Full DocumentRight 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
Background 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
Background image of page 3

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

View Full DocumentRight 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
Background image of page 4
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 
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/07/2011 for the course CSE 111 taught by Professor Howden during the Spring '07 term at UCSD.

Page1 / 14

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

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online