| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
The recent thread on MVC class design got me thinking about MVC separation
in my own app. I have a menu item action connected to the First Responder in
MainMenu.nib. The action method programmatically changes the contents of an
NSTextView.
Currently, I have the action method implemented in an NSTextView subclass. I
subclassed NSTextView for another reason altogether, but I figured since I
already have a subclass, I might as well implement the action method in it.
After reading Apple's documentation on application architecture, which
states that logic specific to an application should be implemented in
controller objects, I'm thinking that the action method should be
implemented in the text view's window controller instead.
What are the advantages and disadvantages of each approach? Implementing the
action method in the NSTextView subclass seems more direct to me, in the
sense that it is the object whose contents need to be changed, so it should
respond to the menu action, rather than waiting for it to travel up the
responder chain to the window controller.
As a side question, should I not be making changes to the text view at the
NSTextView level at all since it is a view object? I.e. Should I subclass
NSTextStorage, NSTextView's model class, and make the changes there?
| References: | |
| >MVC and Cocoa text system (From: Eric <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.