• 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: Should I learn CoreData for this project?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should I learn CoreData for this project?


  • Subject: Re: Should I learn CoreData for this project?
  • From: Kai Brüning <email@hidden>
  • Date: Wed, 4 Nov 2009 12:15:49 +0100


On 4.11.2009, at 11:33, Ruotger Skupin wrote:

more disadvantages to mention:

1. schema updates with every model change if you use an sql store (you have to make a mapping for every single from version/ to version combination you need to support)

In Snow Leopard Core Data does this automatically for "simple" cases. For non-simple cases you would have to write code for migration of non- Core Data documents, too.


2. multithreaded core data is very hard to get right (multiple contexts, data merges)

Isn’t this true for multi threaded code in general?
Seriously, the documentation explains how to structure multi threaded use of Core Data. This might even save you some pitfalls compared with a "naive" approach to multi-threading a model.


3. performance tuning of core data often means making your schema more complex (see also point 1)

Probably irrelevant for the task at hand.

4. debugging core data can be hard (most bugs only get to the surface when you try to save your data).

Sure, you have more black box behavior compared to a hand crafted model. Helps to go by the recommendations in the documentation and avoid anything which smells like a hack.


5. core data throws exceptions all over the place so you may end up with a try-catch block with every data access in your code

Not my experience. As with the whole of Cocoa, exceptions in Core Data indicate programmer errors, which should be fixed before releasing.



If your data set fits in memory and you don't mind loading it all at once, stay away from core data.


my two cents
	Ruotger

On 04.11.2009, at 08:54, Kai Brüning wrote:

Hi David,

this question is most definitely on topic :-)

So, lets see, what would Core Data give you:

- Scalability, fast incremental loads and saves for big data sets.
I don’t think you’ll need this. Loading and saving 500 items each time will be fast enough.


- A data model modeler.
That’s actually more valuable then it may seem on first glance. I often look at my Core Data models when thinking about algorithms and want to recap how the object graph looks.


- Automatic and semi-automatic version migration.
Depends on the lifecycle of your application. When needed, it’ll save you tons of time.


- Object graph consistency management.
A big one. Core Data automatically updates inverse relationships as needed. A lot of work to do manually, and always a source of subtle bugs.


- Automatic undo support.
Big

- Disadvantage: Core Data does not support ordered relationships. That is, it uses sets instead of arrays. If you need an order, you have to manage this yourself. Not hard, but sometimes an annoyance (the reason for this "shortcoming" are hard technical problems).

That’s it out of my head. I’m sure I forgot something.

The learning effort? Hard to say. Core Data is well documented and works (almost always) as advertised. So it depends on how well you learn new abstractions.

One unrelated advice: by all means use garbage collection. It makes object graph management (and a lot of other things) so much easier, no matter whether you use Core Data or not.

Good luck!
Kai

On 4.11.2009, at 05:22, David Hirsch wrote:

So, I'm hearing folks sing the praises of CoreData, which I have not yet learned. It seems like a long uphill climb, but if life will be spectacular afterwards, I'll do it. I am a semi-casual programmer; I've just finished a couple of small programs that do not use CoreData, and I can see the advantage in gaining open/save and undo/redo for free, but I'm concerned about the work I'll have to put in to learn it. I've read a bunch of the CoreData intro documentation, but it doesn't give a feel for how difficult it will be to learn, nor how big the advantages are if I do.

Here's the next project I'm going to work on, for which I'm considering CoreData:

A simulated annealing code for class scheduling. The CoreData part would lie in managing all the lists involved: classes, rooms, instructors, preferences, conflict cost weights, etc. I estimate that I will have about 500 items spread over about 10 arrays. I would not expect to have a complex object graph (if that's the right term) - just a lot of items in lists, items that need to be managed, displayed, saved, loaded, etc. I could use NSArrays for all these, which I currently understand.

Does this sound like it's worth learning CoreData for?

Thanks,
Dave

S.A.: I hope this is on topic; I think it is.

Those recent projects I mentioned:
http://almandine.geol.wwu.edu/~dave/research/code/ModeMaker/
http://almandine.geol.wwu.edu/~dave/research/code/ModeQuiz/


============================ Dave Hirsch Associate Professor Department of Geology Western Washington University persistent email: email@hidden http://www.davehirsch.com voice: (360) 389-3583 aim: email@hidden vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf ============================



_______________________________________________

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

_______________________________________________

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

_______________________________________________

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

_______________________________________________

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: Should I learn CoreData for this project?
      • From: Ruotger Skupin <email@hidden>
References: 
 >Should I learn CoreData for this project? (From: David Hirsch <email@hidden>)
 >Re: Should I learn CoreData for this project? (From: Kai Brüning <email@hidden>)
 >Re: Should I learn CoreData for this project? (From: Ruotger Skupin <email@hidden>)

  • Prev by Date: Re: NSDate / NSXMLParser
  • Next by Date: Re: Should I learn CoreData for this project?
  • Previous by thread: Re: Should I learn CoreData for this project?
  • Next by thread: Re: Should I learn CoreData for this project?
  • Index(es):
    • Date
    • Thread