> On Dec 5, 2015, at 12:40 , Quincey Morris > <quinceymor...@rivergatesoftware.com> wrote: > > On Dec 5, 2015, at 12:20 , Rick Mann <rm...@latencyzero.com> wrote: >> >> I'll probably make the document a delegate of the view controller so it can >> be informed of changes to the model. > > This may not apply to your app, but what I usually end up doing in an app of > any complexity is have (essentially) two data models. The “real” one belongs > to the document. Then there’s a “derived” data model (usually in the window > controller in the past, but possibly in the new, enhanced view controllers in > the future) which rearranges the document data model suitably for the > particular UI that the particular window UI finds convenient. > > This is kind of duplicate effort (though not duplicate data, mostly, because > the “derived” data model really is only a wrapper around the real one), but > it tends to simplify the UI code a lot. For example, if the real data model > is flat but the UI displays the data hierarchically, it may be easier to have > an outline view connected to a hierarchical data structure. Or if data model > values need to be transformed into displayable strings in customizable ways, > it can be done in the derived data model.
Not a bad way to look at it. I'll see what makes sense as I go forward. This is a utility app for use inside my company, so it's inevitably going to grow organically. I can just foresee many of the aspects right now. > > Or (and this can be a fairly important issue) undo groupings are really > structured by the UI, even though undo actions are associated with the > document. It often makes more sense to have the window controller decide how > to package (and how to name) undoable sequences, rather than leaving it to > the granularity of document model property updates. Yeah, I think you're right about this. -- Rick Mann rm...@latencyzero.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com