For a variety of reasons, I use Core Data with OpenGL all of the time.  One of 
my presentations this weekend at "Voices That Matter: iPhone Developers 
Conference" uses a Core Data application with two different Views as an example 
of the MVC design pattern.  One View presents information about the Model using 
Core Graphics/Quartz.  The other View presents information using OpenGL ES.

I think that the Core Data model and any generated classes should be left 
untouched because you may want to regenerate the classes later.

I use Categories to add View specific drawing methods to the objects that 
represent Core Data entities.  There are different categories with different 
methods in each View.  E.g. there are -drawInOpenGLContext: methods added to 
entity objects within the OpenGL View subsystem and there are 
-drawWithCoreGraphics methods added in the Core Graphics View subsystem.

There is ample precedent for adding View specific capabilities to Model objects 
via categories.  AppKit adds string drawing methods to NSString.

You definitely don't want your View subsystem constantly asking Model objects 
what kind they are in order to present information.  If you have ifs or 
switches based on the class of objects or even based on an attribute of an 
Entity, you are doing it wrong.

It is much cleaner to use the built in language polymorphism.  Just keep View 
related code implementation within the View.


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to