• 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 design question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data design question


  • Subject: Re: Core Data design question
  • From: Scott Stevenson <email@hidden>
  • Date: Tue, 3 May 2005 11:12:15 -0700


On May 3, 2005, at 10:16 AM, John Timmer wrote:

I've got a series of NSManagedObjects and subclasses.  Most of them have a

"notes" field holding RTF saved as NSData.  I'd like to expose the text of

these notes to being searched by adding a method that makes an attributed

string out of the data and then extracts the raw string.  The question is:

where do I put this method?  I could:


Add a category to NSManagedObject with a "searchableNotes" method and trap

exceptions for when the "notes" key doesn't exist.


Subclass NSManagedObject, add the "searchableNotes" method, and make all the

objects with a "notes" key subclasses of this.


Assume that the "searchableNotes" method won't change, and just add it in to

any classes that need it.


I'm leaning towards the middle option since it seems the cleanest, but was

wondering if there were other reasons to favor one or another of these?


Out of the options you provide, I personally like the first one since it doesn't force a data class to inherit something just for this one bit of functionality. It's the least rigid option.

You might also consider making a full-fledged Note Entity, which can have multiple representations. This might give you the ability to have some extra features too.


   - Scott


--

http://treehouseideas.com/

http://theocacao.com/ [blog]



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

This email sent to email@hidden

References: 
 >Core Data design question (From: John Timmer <email@hidden>)

  • Prev by Date: Re: OutlineEdit example (_NSArrayControllerTreeNode)
  • Next by Date: Re: Core Data design question
  • Previous by thread: Core Data design question
  • Next by thread: Re: Core Data design question
  • Index(es):
    • Date
    • Thread