View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sp02 Final Exam Review: Segway Palm Pilot

Edit Sp02 Final Exam Review: Segway Palm Pilot here.


c.i. errands do: [:location |
gridMap highlightFor: location].
c.ii. If you didn't mind it printing the streetname each time an errand was found at that street (after the first)

b _ Bag new.
errands do: [:location |
(b includes: (location streetname)) ifTrue:
[Transcript show: `There is more than one errand on street: ', streetName].
b add: (location streetname)].

If you want it to only print each streetname once that has more than one errand:

b _ Bag new.
errands do: [:location | b add: (location streetname)].
b do: [:streetName | (b occurencesOf: streetName > 1) ifTrue:
[Transcript show: `There is more than one errand on street: ', streetName]].

Hank Wilde


i was thinking maybe a set instead of a bag?

streets := Set new.
streetsWithMultipleErrands := Set new.

errands do:[:location |
streets includes: (location streetname)
ifTrue: [ streetsWithMultipleErrands add: (location streetname)]
ifFalse: [streetList add: (location streetname)].
].

streetsWithMultipleErrands do: [:streetname| Transcript show: streetname].

ellie


Any designs? Design Patterns?



A. Here is a quick design that I threw together. I just realized that in this design I forgot to put some services in the Palm class. It should probably be able to interface with it's different components. It should have services called raiseVolume, play, stop, openAddressBook, makeCall, and maybe useGPS or something along those lines.
Uploaded Image: segueDesign1.jpg
B. I'm a little foggy on design patterns so please correct me if I'm wrong here. The Command Design pattern would be useful in this problem. With this pattern you can get a desired functionality without specifying the actual method name. This pattern could be used in the GPS class when it comes to locating a location on the map by either GPS coordinates or street addresses. It could also be used for the buttons that are on the actual SegPilot itself. That way when a button is hit it could just call a method by the name of that button, like play or seek, and from their the actual method could be called to do the desired task.
c.
i)
errands do: [:errand |
gridMap highlightFor: errand.
].

ii)
errands do: [: errand|
name := errand streetname.
(streets includes: streetname) ifTrue:[
Transcript show:'There is more than one errand on
street:', name, String cr.
].
streets add: name.
].

Eric Soto
Note that your design didn't have to cover the radio/MP3, too. Do you need the Palm class? Why? Command could work (particularly arguing for "play" meaning different things for Radio and MP3), but others could,too. Mark Guzdial




Design Patterns:
Bridge - The normal functions such as appointment book,
to-do list, and phonebook functions can probably have the
same operations just a new look.

Randy Rockinson
Why is that a Bridge? Could you use a Factory here? Mark Guzdial


seems like observer would be an obvious design pattern consideration for any program with a gui. yes, i think a factory could be used to decide which object to return.
ellie



Link to this Page