Re: Should I learn CoreData for this project?
Re: Should I learn CoreData for this project?
- Subject: Re: Should I learn CoreData for this project?
- From: "email@hidden" <email@hidden>
- Date: Wed, 4 Nov 2009 12:11:42 +0000
Core Data is powerful stuff but it can be tough going - very tough
going.
If you are determined to make your code work you will get through it.
If not, it might get the better of you.
The fact is that CoreData offers a great deal of functionality. If you
want that functionality you either code it yourself or use CoreData.
My four main points would be:
1. Keep going back to the documentation. It takes time to grasp all
the concepts. And as with most things Cocoa you need to go with the
flow. But if you don't keep querying and checking your own
comprehension of what's going on it's hard not to end up on the rocks.
2. Keep everything in the model if humanly possibly and use transient
properties for stuff you don't model directly. Mucking around with
ivar backed NSManagedObject subclass properties and references to
external files etc will drive you crazy when it comes to figuring out
why your undo support is scrambled.
3. Performance should be very good. If it's hopeless then you are
doing it wrong. It's easy to fire up IB, set up some bindings, bash in
some data and have the whole thing turn to treacle in a storm of
faults and KVO notifications. You need to think carefully about how
you retrieve data from the store (as objects or faults). You really
need to get your head around the concept of faulting and your data
access methodology.
4. It isn't really anything like using a conventional SQL driven
database. So don't even bother trying to wing it on that score.
The big plus for CoreData is that you can implement a simple app that
simply grabs all your data in one chunk, loads up some arrays and you
are away.
If later on your app develops and you need a much more sophisticated
approach then CoreData can deliver.
Ordered relationships are not that big a problem. The order is just a
property of the model.
Of course there is the whole business of having to deal with schema
updates.
But this is an issue for whatever persistence method you choose.
Regards
Jonathan Mitchell
Developer
http://www.mugginsoft.com
On 4 Nov 2009, at 04: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