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

Spring2004 Midterm Review: Changed/Update mechanism

Edit Spring2004 Midterm Review: Changed/Update mechanism here.

when clock does next second, it makes the call to self changed: #time, where #time is the aspect of the model that has changed. Then, the dependant views..of the clock model, in this case ClockText, make the call..to update: #time.. update checks to see if the aspect being passed in, is #time, then..time is appropriately updated. (it does so by performing a query of that #display on the model, retrieving the proper value, and then displaying it).
[This is somewhat incorrect. ClockText doesn't call update – it's just the receiver of the update call.]

In this system, Clock is a model and ClockText is one of its dependents. When clock receives the nextSecond message, it sends itself the changed message specifying that #time has changed. When clock receives the changed message it sends the update: message to all of its dependents. ClockText receives this message and a parameter specifying that #time has changed. After receiving this, it make a query on the model (Clock) for the current time. It then displays this time.

Nicely done! Rich LeBlanc

Link to this Page