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

Fall2002 Midterm Review: Changed/Update mechanism

Answers:

When a second of time passes by:

SecondsTicker tells the Clock to update itself by calling nextSecond.

nextSecond tells the Time object in Clock to add one second to itself. It also lets its dependant, a ClockText object, which contains a model of Clock, know that it has changed. It "announces" the change, which is not specific to one dependant, but to all dependants.

ClockText checks this change, makes sure its the correct one, and queries the model, finally redisplaying the time.

The question asks for the sequence of messages, so you should be more explicit about just what messages are sent to notify ClockText and for ClockText to get the information it needs. Rich LeBlanc

How does
Change - Announce - Update - Perform sound?

That's closer, but some information about what object is sending the message and to whom it is sent would make it more complete. There is a diagram in Chapter 5 and in the lecture slides that would be another way to capture the same thing. Rich LeBlanc

SecondsTicker sends the change message to the clock - from there the clock updates self as needed and updates its dependant clockText with the new time

Link to this Page