From: Jeff Cohen Date: 2006-04-06T10:58:40+09:00 Subject: Re: best practices For me, this dilemma (long one-liner vs. several short lines) is usually a sign that I need to refactor. I will always take this: songs.append(Song.new(title, name, mins.to_i * 60 + secs.to_i)) and write it as duration = mins.to_i * 60 + secs.to_i song = Song.new title, name songs.append song then refactor it into def append_song(title, name, mins, secs) duration = mins.to_i * 60 + secs.to_i song = Song.new title, name songs.append song end so then the original line way above becomes append_song title, name, mins, secs And then I feel great: it's a one-liner in the upper code, but the code that does the work is still very readable (and also potentially easier to reuse). There's almost never a code-appearance problem that can't be solved with another level of refactoring :-) (with apologies to Butler Lampson; http://en.wikipedia.org/wiki/Butler_Lampson) Jeff www.softiesonrails.com -- Posted via http://www.ruby-forum.com/.