Posted by MARINA on July 13, 2001 at 13:14:48:
In Reply to: Hey, check this out posted by Alan Fong on July 12, 2001 at 22:00:21:
: Either I've gone insane, or I actually understand something!
: remember how the professor was like, dont create a foo until you need it? and we're like, how is that?
: REQUEST_RESULT create_foo(unsigned char process_id, unsigned long int initializer, unsigned long int & references)
: ok, that doesn't fit neatly on one line, but essentially its a:
: process_id : now if you notice, none of those were the mysterious foos that DVW talks about. they are the ingredients. most of us were going to combine the ingredients into the foo class, and get some weird foo cake. then we were going to store the weird foo cake in a tree, or linked list, or something. Making this foo cake was what DVW was talking about taking a long time. : Now, please bear with me. Sometimes people order a foo cake, but they never pick it up. It wastes our time, and takes up space. Now, foo cakes are different. think of the seed values, i mentioned above as like: : strawberry, banana, chocolate. : ok. that was off the topic. : lets say, Natalie wants a foo cake. say she wants spam flavored foo cake. when we take the order, instead of making it right away, we just write her name down, and what flavor, spam, and where were going to put it when we make it. Natalie might not come back to pick it up, so instead of making the cake, we write down: : Natalie, spam, shelf slot 1 : corresponding to who asked for it, what flavor it is, and where on the shelf were going to put it if we make it. then we store that in the tree, array, linked list, etc : if and when Natalie appears, well pull out the piece of paper, and make her a spam cake, the sicko. so we only make it if she comes back to claim it. : now foo cake has strange and mysterious properties. if you make a foo cake, you can cut as many slices of it as you want. Foo cake is infinite. So if say, Marina, wanted some spam cake, we wouldnt need to make a whole new spam cake, we just cut her some from the one we made for Natalie. The address is also important cause we wouldnt want to give her the wrong cake. : And deleting the cake means you cant cut anymore slices from it. so if someone asks for it again, you got to make it again. : um, if you can see through this thick metaphor, i think it should be a little helpful. : Im going to eat some cake now. : Later : Alan Marina.
: initializer
: references
Hey, Alan.
Thanks for explanations. One question:
is it efficient to have an array/list/whatever for orders, where each element would be a pair of a pointer and a value? That's the only solution I have in mind. But then I would have at least 2 structures in total(map and array). That's already bad, isn't it?
Also we have to keep track of time, to make a decision which foo to delete later, when we run out of space. So the question is: do we need another list/array/whatever to associate the time stamp with each ever accessed foo?
Or may be we should make it more beautiful, for example create an additional class, where we would store all this sh-t?
I'm a little bit lost.... Can't make a right decision. Please, give an advice...