Re: MVC question about updating the Model
Re: MVC question about updating the Model
- Subject: Re: MVC question about updating the Model
- From: Kyle Sluder <email@hidden>
- Date: Fri, 16 Apr 2010 11:00:29 -0700
On Fri, Apr 16, 2010 at 10:51 AM, Quincey Morris
<email@hidden> wrote:
> For timed updates, you seem to have a choice of putting the timer in your data model, or putting the timer in your window controller. One good way to decide this is to ask yourself this question:
And this is when I become a fan of splitting the "model" layer into a
"model object" layer and a "model controller" layer. The "model
object" layer just contains a bunch of bags-o-data. In simple
applications this might be a few NSDictionaries; in more complicated
apps it might be a Core Data object graph. But the objects themselves
are concerned only with storing and retrieving data associated with
themselves; maybe some simple validation like "this property can't be
null" or "only one of these two properties can be set."
But the real business logic would live in the "model controller"
layer, which deals with entire graphs of model objects. This is really
where the heavy lifting goes; things like saving/loading,
calculations, or even periodic updates. It stores the results of these
sorts of operations inside the dumb-bags-of-data. It's this layer that
the view-controllers like NSWindowController or NSViewController talk
to.
--Kyle Sluder
_______________________________________________
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