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

Spring 04 Midterm 2 Review: Segway Palm

b. Identify one design pattern that would be useful in this problem. Explain how it would be useful, and identify specific classes that you would use in a design for this problem that would correspond to the design pattern participant objects.

Bridge would be very useful for the speaker jack. The speaker jack acts the same way whether it is communicating with the radio or the mp3 player, but it needs to speak with these differently. That is entirely internal, and speaker jack would know how to decide. The SpeakerJack is the interface. SpeakerJackImpl is the implementation interface. RadioSource and Mp3Source are the implementations of the implementation interface.

RadioSource and Mp3Source could use adapters to implement the interface required in the above.
Andrew Sayman



b = Bag newFrom: (errands collect: [:e| e streetname])."Get streets with dups"
s = Set newFrom: (errands collect: [:e| e streetname]). "Get unique streets"

s do: [:street| "For each unique street"
((b occurrencesOf: street) > 1) ifTrue: [ "If more than 1 errand"
Transcript show: 'There is more than one errand on street: ', street; cr.]].

Link to this Page