From: "Victor \"Zverok\" Shepelev" Date: 2006-11-25T16:36:31+09:00 Subject: Re: Rubyish inst.var initializations From: Robert Klemme [mailto:shortcutter@googlemail.com] Sent: Friday, November 24, 2006 9:51 PM >On 23.11.2006 02:36, Victor "Zverok" Shepelev wrote: >> From: dblack@rubypal.com [mailto:dblack@rubypal.com] On Behalf Of >> dblack@wobblini.net >> Sent: Thursday, November 23, 2006 3:31 AM >>> On Thu, 23 Nov 2006, Victor "Zverok" Shepelev wrote: >>> >>>> Hi all. >>>> >>>> I have some huge class with aspects of functionality spreaded in >several >>>> source files. >>>> >Frankly, I believe this is not a too good idea. There should be one >main place (i.e. file) responsible for this class's definition and all >other places should only add to that class. Changing initialize's >signature would certainly be not a good idea either. > >If you feel, you have to initialize additional fields, then this is a >cleaner solution - and also more modular: > >class Foo > def initialize(a,b,c) > super > @a=a > @b=b > end >end > >module Mixin > def initialize(*a,&b) > super > @foo = [] > end >end > >Then you can safely do in another place: > >class Foo > include Mixin >end Robert, thanks. It's a REALLY good point. I've completely haven't think about mixin's initialize. Would guess it. V.