From: Mike Durham Date: 2006-12-04T17:30:07+09:00 Subject: Re: Simple and stuppid bug (can anyone find it?) David Vallner wrote: > paul wrote: >> My second idea was to use attr_writer to set all the properties, but >> chaining seemed saving me some lines (these assignments aren't that >> exciting after all). >> > > Either way, I don't agree with the motivation, it's very easy to lose > track of what you've assigned to in a method chain as an extension of > the fact any method chain is a detriment to readability if the steps > aren't trivial (e.g. require keeping in your head what the previous step > returned). > > Personally, I'd go with the options hash Martin DeMello proposed. It's > rather idiomatic, easier to read (a bit) than a method chain since > initialisation logic is kept in the call to #new, and doesn't involve > superfluous typing. > > David Vallner > In my opinion, if I understood the problem correctly, if a function/method ends with a 'return self (or whatever)' then that's what should be returned. There is no acceptable excuse for nor returning it. Cheers, Mike