Re: MVC question about updating the Model
Re: MVC question about updating the Model
- Subject: Re: MVC question about updating the Model
- From: Graham Cox <email@hidden>
- Date: Sat, 17 Apr 2010 00:05:30 +1000
On 16/04/2010, at 11:30 PM, Matt DeFoor wrote:
> 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?
No, because if another controller is able to affect the model, the update won't get noticed.
The resource should keep track of WHEN an update is required, but it should not make any assumptions about HOW the update is actually accomplished. It can do that using classic notifications or KVO. The controller(s) can receive those notifications and translate them into the required actions on the view(s) they control to get the update performed.
Also, having a manual refresh button should be unnecessary - if your resource is always able to flag an update whenever a change in its state occurs, then there is no possibility that the view and the model will get out of step.
--Graham
_______________________________________________
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