On Jun 24, 2013, at 07:49 , Flavio Donadio <fla...@donadio.com.br> wrote:

> After reading all this thread and watching it deviate from the problem at 
> hand into a philosophical argument, I think it's time to answer the 
> unanswered question...
> 
> Rick Mann, I don't understand why you need a separate relationship to 
> retrieve the active Child objects. Please, consider doing this:
> 
> Parent
> children     to-many to Child
> 
> Child
> parent       to-one to Parent
> active      (boolean)
> 
> And then create an activeChildren: method in Parent with returns only the 
> active children.
> 
> Sorry if this is not acceptable. I am just trying to help.

It's a fine suggestion, Flavio. I've used it in other places. But it requires 
better discipline when programming, if there can be only one active child (per 
parent). You can't just set active to true, you have to also ensure any other 
active child is set to false. You can create methods for this, and make active 
a private or read-only property, I suppose. You could even make it a transient 
property on Parent and just fetch the active child on awake.

Seems easier to have a relation on the parent to enforce this; there's no way 
to have more than one active child.

-- 
Rick




_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to