From: Simon Strandgaard Date: 2004-05-22T04:04:40+09:00 Subject: Re: begging for a hint in app design Benny wrote: > my problem is: I dont want to pass "args" and "other" everytime a Components > subclass is initialized (since its already in the MainClass) and I guess it > is expensive. the components subclasses are only used within the context of > MainClass. I want the app to be as fast as possible: what is the best > design therefor (thinking of mixture, modules, inheritence etc)? > > def ini_component() > require(@file) > puts eval("#{@comp_name.capitalize}.new(@args, @other)") ^^^^^^^^^^^^^ ^^^^^^^^^^^^^ I would probably pass 'self' to the instance. Then a few cycles later, the instance can fetch the necessary data from the owner. > # do something > end -- Simon Strandgaard