Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Yet another MVC question

 
Nate Johnson
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My MVC design is as follows... each client has a model, view and controller. The model/view is done with the Observer pattern. So, when the controller gets an event from the view (click of a button, etc.), it tells the model how to update its data and then the model sends out a notify to all of its observers (when a view is created, it "attaches" itself to the model so it can be notified of model changes).
My question is this... it seems that the model would notify two different clients that data has been modified, but since each client has its own instance of a model object, this does not happen. If the model where a single instance (btw- this would only apply to network mode ) and every client registered with that, then the notifies would go to all clients.
So should my MVC have a factory that gets models (I already have a factory for connections -- the LocalData object vs RemoteData object)? That way, I could have the remote server send back the same model for every client, and all clients would be notified for all updates. In local mode, the factory would just pass a ref back to the local model.
Any thoughs?
[ July 30, 2002: Message edited by: Nate Johnson ]
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

My question is this... it seems that the model would notify two different clients that data has been modified

It's not in the requirements that client A should be notified when clent B changes the database. For this assignment, the purpose of the model would be to notify the multiple views (if any) of the same client.
Eugene.
 
Nate Johnson
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Eugene... I thought I was probably just complicating things (and confusing myself)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic