Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is it like this?



On May 30, 2005, at 10:57 PM, Andy Lee wrote:

I have an inheritance hierarchy of model objects. Lists of those objects get displayed in different ways in various places throughout my UI. It would be convenient for the objects to have methods like -stringToDisplayInXYZBrowser and - stringToDisplayInABCContextualMenu, but this means model objects would be aware of the specific views they will be displayed in. I *might* be able to put the display methods into an informal protocol, and implement them in categories of my model objects. I'm considering that for a future refactoring, but right now I'm using lightweight wrapper objects around the model objects.

Not really sure what your overall design is, but isn't that pretty much the situation that the NSFormatter and/or NSValueTransformer classes were made for? They both act as intermediaries whenever there's an "impedance mismatch" between what the view needs, and what the model provides.


sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Why is it like this? (From: Gregory Weston <email@hidden>)
 >Re: Why is it like this? (From: Thomas Davie <email@hidden>)
 >Re: Why is it like this? (From: Gregory Weston <email@hidden>)
 >Re: Why is it like this? (From: Thomas Davie <email@hidden>)
 >Re: Why is it like this? (From: Aaron Fothergill <email@hidden>)
 >Re: Why is it like this? (From: Andy Lee <email@hidden>)



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.