On Aug 27, 2008, at 9:43 PM, Caleb Strockbine wrote:
There is no need to create a custom class if all you're doing is
declaring accessor methods.  Your reply did not state that.
Perhaps I'm being dense here, but why would you use a category on NSManagedObject to declare accessors that only actually apply to a single entity? Managed object models typically contain more than one entity, and each of those entities necessarily has a different set of properties (otherwise, you wouldn't need more than one entity). If you use a category on NSManagedObject to add accessors for each entity in your model, don't you end up with a situation where all your entities have declared accessors for other entities' properties?

Yes, but you're just *declaring* a category, not implementing it.

On the other hand, if you subclass NSManagedObject where necessary, each subclass' accessors will be specific to it's corresponding entity.
Am I missing something?

If you use a category, you don't have to create subclasses just to keep the compiler happy. This is particularly useful early in the lifetime of your project as your entity/class names may be more volatile -- you don't have to maintain otherwise-unused custom classes.

It's a trade-off, but an important one to be aware of.

mmalc

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to