MVC question about updating the Model
MVC question about updating the Model
- Subject: MVC question about updating the Model
- From: Matt DeFoor <email@hidden>
- Date: Fri, 16 Apr 2010 09:30:44 -0400
I'm having a problem deciding on how a Model object should be updated.
I have multiple resource objects that are represented in an
NSOutlineView. These resource objects can be updated by their own
triggered timer or potentially on demand by the user via the View (a
button is clicked in the UI).
At first, I thought that the resource object should have the
capability to update itself. Therefore, the resource has a method like
so:
[resource update];
If the resource's timer fires, it calls it's update method like so:
[self update];
If the resource update button is clicked by the user, the selected
resource item is updated by the NSWindowController with:
[resource update];
This is where I'm having difficulty determining what should be
standard practice. Would it be better to post a notification that
indicates the resource should update itself? Or is it good enough to
leave it as is?
One other approach I've considered is whether the Model should have
the ability to update itself at all. Should the controller be
responsible for updating the resource always?
It seems that either approach is viable, but which is better?
-Matt
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden