On Fri, Nov 13, 2009 at 6:11 PM, David Catmull
<uncom...@uncommonplace.com> wrote:
> Currently, I'm listening for 
> NSManagedObjectContextObjectsDidChangeNotification. This is working fine for 
> additions and deletions, but it's harder for changes, mainly because I don't 
> know the old value. If I did, I could check if the old year still has any 
> other objects in it. As it is I have to refresh the whole list. I also get 
> more notifications than I need, since I only care about date changes on this 
> one entity.

1) You could model the years as well.  To crib Michael Jurewitz's
theme from the iPhone tech talks, "Normalize as much as possible, then
denormalize as necessary."
2) There are data structures you can use to make it relatively
efficient even when you don't know the previous value.  You're already
given the changed-object set as it is, that's the best optimization
you can make.
3) The notification approach will eventually be much faster than the
KVO approach.  "Eventually" is to be determined.

For your case, think of # of objects / # of possible years.  I can't
imagine you have more than a 10 year range?  Just keep an array of
sets around and add/remove as dictated by the change notification.

--Kyle Sluder
_______________________________________________

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 arch...@mail-archive.com

Reply via email to