From: Robert Klemme Date: 2004-07-23T20:16:59+09:00 Subject: Re: Referencing objects and program design "Stephan K�mper" schrieb im Newsbeitrag news:2mad8rFkqh7mU1@uni-berlin.de... > Hi, > > Thanks for that answer (this goes to Assaph too, of course). > > Robert Klemme wrote: > > > > If there are no special requirements for your object ids I suggest to use > > Object#id and ObjectSpace#_id2ref: > > I'll add that to my notes and think about it. I'm still wondering what you're at... > > You could better use a Set here. That saves you the inefficient check > > (with an Array this is O(n) where n is the number of oids stored so far; > > with a Set (hash internally) it's ~ O(1)). > > Thanks for the tip - I'm currently still in the second of the three > phases (Make it run, make it right, make it fast)... :-) Well, in that case I'd say performance is a nice add on but the real benefit is that you use the appropriate abstraction: you really want a set, so use a set. > > I'd go for add_ref1 - although you should uncover a bit more of the > > problem you are solving. > > Yes, in the meantime I've come to that conclusion, too. > Having worked for an object-oriented database vendor some time ago, > things like traversing object networks, persistence and similar themes > come to my mind now and then... :-)) > Happy rubying Always! :-) Regards robert