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

S05SF: Question 2

Post trial answers here for the Summer 2005 Sample Final
MVC
1) We know that MVC make cleaner OO structure and easy for object for communicate to each other. Minimizing the information sharing forcing change: and update when needed. Modal are sort like holding some dependency objects or instances variables dependents. Views rely on this dependence to notify changes int model. So the new view is given than register self as dependent to the model. Therefore this communication between methods are thru updating; and message changed begins to anounce all dependent objects.
Marco Lin

That's a good summary of the general purpose of MVC. What about the specific methods changed: and update: ? In which class do each of these methods show up in, and what is the purpose of each one of them? -Lex Spoon

2a) Model has the changed method and the View has the update method. Model's announce that they have been changed by calling self change: #change which sends a message to all Views that they need to update. Views can be sent the change only if they are added as dependents of the Model, and can choose whether they need to update based on the given aspect of the (Model's) change. The Controller (UI) is a tool to change the Model.

2b) The methods that should send the self #changed: #aspect –
  1. matchingNameSelected: – this will send a changed to all text morphs with the name selected.
  2. name – send change to list morph with new name
  3. address – send change to address book
  4. phone – send change to phone book
  5. searchPattern – send change to matchingNameSelected:, then sends change as #matchNameSelected: to change text morphs.
  6. newAddressRecord – sends change to update all fields.

Methods that should implement update:
searchPattern - to update new search text
name - to update name in field
address - to update addres in field
phone - to update phone number in field
list - to update matching list of records

Ahmed/Dillon/Edwin

1) #changed is the Model's way of telling anything that's interested in it that it has changed. The parameter to #changed is the function that any of these listeners or observers should call, if they're interested, to find out what changed. #update is the Controller/View's way of telling the Model to update itself based on input from the user. The parameter to #update is the method/procedure/whatever that the Model should run to update itself. Usually, an #update call to the Model is followed by a #changed call to all the views, since the model would then want to tell all its observers that it has indeed changed. -Omar Zakaria



2)
#changed
searchPattern, address, name,

  1. updated
List


2) how 'bout:

 #changed
#name:, #phone:, #address:.

Each of these will send the #changed: message to the view, along with the name of the respective method.
(ex: #name will call: self changed: #name).

Good thinking but this is not quite right. Would anyone else like to take a shot at it? -Lex spoon



In addtion to the Name, Address, and Phone fields the Search Box and Search Results can be modified.
So the changed paraimiters are:
. #name #phone #address #searchBox #searchResults

So ignoring all the obious self changing stuff (name: doesnt really need to send #name, as Text morph already can change itself, though if you were trying to do something fancy like put two view on the same model you may want to) we have:
searchPattern: -> #searchResults #name #address #phone
matchingNameSelectod: -> #name #address #phone
newAdressRecord: -> #searchBox #searchResults #name #address #phone

Link to this Page