Ordered lists WAS ADC Core Data article
Ordered lists WAS ADC Core Data article
- Subject: Ordered lists WAS ADC Core Data article
- From: John Brownlow <email@hidden>
- Date: Fri, 8 Apr 2005 14:09:52 -0400
Following up on the discussion about EOF to which I posted a link few
moments ago...
I am going to make an analogy here so we don't have to tiptoe around
the NDA.
I have a lot of toys in my bedroom, which is very untidy. Currently
when I go to bed (which I call 'Saving') I have to put all the toys
into their neat little boxes (NSCoding). This is very tiring.
Then one day my mother (whose name is Steve) gives me a magic bag with
"EOFEditingContext" written on it, then crossed out. They have written
some other words on it but they are in invisible ink manufactured by
NDA, Inc of Cupertino.
The bag is magic because I can just say "Bring me all the GI Joes with
broken arms" and it will magically appear. And when I have finished
playing with GI Joe, when I go to bed, he magically jumps back into the
bag, wearing the new clothes I have dressed him in, ready for the next
day.
Okay, sounds great. Thanks, Mom.
But one day I take out a bunch of toys and put them on my floor. I
leave the room, and when I come back, my friend (whose name is User)
has reordered the toys in the line. He wants me to remember the order
he put them in, which makes no particular sense to me.
Here's the problem with the Magic Bag. The toys don't necessarily come
out in the order you put them in.
Here's my question:
How do I put them back in the bag so that the next time I take them
out, I can put them the order my friend User wants?
It's no use saying "take them out and sort them" because I don't know
how my friend chose that ordering. It's whimsical.
I have to find some way of remembering it.
It seems to me I can do one of three things.
-- Write a number on each toy with magic marker. However this ruins the
toys, which may be valuable antiques! And in any case, they may be in
multiple bags.
-- I can put each toy in a disposable box, and write a number on the
box, then put the boxes in the original bag. This works, but now I have
to remember to take the toys in and out of the boxes when I want to
play with them. So the bag is not so magical any more.
-- I can make a list of the toys which says
1 -- the rocking horse
2 -- the doll
...
n -- the nth toy
But where do I put the list? I suppose I could fold it up (NSCoding)
and put it in the bag with the objects but now I have to remember how
to unfold it when I take the toys out of the bag -- and the whole point
of the bag was to make it easy to tidy up!
You see, what I really want is not a magic bag but a magic box which
can remember the order of the toys. And then I can put the toys in the
box, put the box in the bag, and hey presto!
Was this addressed in EOF? And if so how?
Next time: what happens when my friend turns up with a book called
"Every Child's First NSDictionary".
--
John Brownlow
Deep Fried Films, Inc
http://www.johnbrownlow.com
http://www.pinkheadedbug.com
_______________________________________________
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