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

Fall 04 Midterm 2 Review: Changed/Update mechanism

When the Clock's nextSecond occurs, the model will notify that it has changed its time. The view dependent ClockText will then be ask to update. The ClockText will query the model for what to display. The model will perform the query message and reply to the view what to display.

~Quoc Tran

you need a more specific answer. also, make sure you understand the general usage of changed/update.... how does the model notify that it has changed? who does it notify? what does "ask to update" mean? how does the clockText query the model, how does it know what to query? maybe it would help to break it down into method calls & also the preliminary steps: how do we set up dependents? etc? -ellie

The SecondsTimer ticks, the nextSecond message is sent to the Clock. As part of the Clock's nextSecond message, self changed is called with the paramater of #time, the fancy fast strings. This self changed sends an event to all the dependents who have been set as dependent on the clock (these are set in the ClockText, where it stores its model, it adds the model to itself as a dependent using aModel addDependent: self).

Since the model time has now been updated using self changed: #time (or some other fancy fast string), then the dependents get sent an update message with the paramater being the parameter to 'model' changed. update then knows what to do thanks to the fancy fast string #time, which it uses to check what it has to do.

Link to this Page