• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Philosophical Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Philosophical Question


  • Subject: Re: Philosophical Question
  • From: email@hidden
  • Date: Sat, 4 May 2002 22:47:20 -0400

Not knowing anything about your app, except what you write below, I will attempt
to make some observations.

I think a fundamental error made when using MVC with the Document App is assuming
that the Document is the model. It's not. The document is the controller. It is the adaptor between the view and the model and the interface between the model and the archived
representation of the model. Everything goes through the Document. The reason for this
is that the document can easily keep track of changes (and thus prompt the user to save before quitting) as well as keep the views synched with the model.

BTW I always anchor my models with a root object that is not the Document. This makes
archiving and unarchiving a snap.

I don't understand what you mean about having two delegates. The document class should mostly handle the menus. Are you unaware of how the menu action routing occurs in Cocoa? You add actions to the FirstResponder in the MainMenu.nib and the same actions to your MyDocument.nib and the actions get routed through like magic.

HTH,

Robert.


On Saturday, May 4, 2002, at 10:18 PM, David Wood wrote:

I think I understand the CVM programming model well enough to code something basic in it. The only problem is now that what I really *want* to construct doesn't seem to fit the model. So I'm wondering if there's any good time to break it.

I tried basing the thing on the Cocoa Document App, and quickly added a whole bunch of model classes to the customized document class. The document would manage two different NSMutableDictionaries and two different NSMutableArrays with document data; the "document" itself is highly object-oriented, and the two different types of objects will have their own interactions.

The problem was, I started putting that together and realized I was trying to build an app with *two* Delegates -- the document class, and whatever was handling the menus. Unless of course I wanted to create an app with just the basic menus. That, needless to say, Didn't Work.

Obviously I'm still learning the whole Cocoa framework, programming in Objective C, and the specifics of Mac OS X's foundation classes. So I apologize in advance if this seems to be too rudimentary a question for the list. But I figured, why not ask? What's the worst that could happen?

--David http://skipjack.bluecrab.org/~dwood

"I had REALLY high hopes when I saw the URL http://www.furby.com/furby/breaking.htm ...but the blasted thing was just a news page."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Philosophical Question
      • From: David Wood <email@hidden>
References: 
 >Philosophical Question (From: David Wood <email@hidden>)

  • Prev by Date: Philosophical Question
  • Next by Date: Something folks might like
  • Previous by thread: Philosophical Question
  • Next by thread: Re: Philosophical Question
  • Index(es):
    • Date
    • Thread