• 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: Core Data - use of simple accessors vs. KVC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data - use of simple accessors vs. KVC


  • Subject: Re: Core Data - use of simple accessors vs. KVC
  • From: Negm-Awad Amin <email@hidden>
  • Date: Thu, 28 Aug 2008 08:11:05 +0200


Am Do,28.08.2008 um 06:43 schrieb Caleb Strockbine:


On Aug 27, 2008, at 2:43 PM, Negm-Awad Amin and mmalc crawford argued:

You can subclass NSManagedObject and add properties using
@property and @dynamic, which means, that the accessors will be
generated dynamically at run-time. (Without @dynamic you will get
a compiler warning: incomplete implementation blablabla)

There is no need to create a subclass,
"You *can* subclass NSManagedObject
"
you can use a category instead.
There is no need to create a category. You can use a subclass instead.

It's not clear what your point is.
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? 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?
No, you misssed nothing. Using a category of NSManagedObject is mixing machine.

You should never do that.


Cheers, Amin


-Caleb

Amin Negm-Awad email@hidden




_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Core Data - use of simple accessors vs. KVC
      • From: mmalc crawford <email@hidden>
References: 
 >Re: Core Data - use of simple accessors vs. KVC (From: Caleb Strockbine <email@hidden>)

  • Prev by Date: Re: NSFileManager Help
  • Next by Date: CFBundleIconFile: heiß or hot?
  • Previous by thread: Re: Core Data - use of simple accessors vs. KVC
  • Next by thread: Re: Core Data - use of simple accessors vs. KVC
  • Index(es):
    • Date
    • Thread