From: "Simon Kröger" Date: 2006-04-07T07:26:21+09:00 Subject: Re: best practices John Carter: > [...] > One hard and fast rule. NEVER BURY SIDEEFFECT EXPRESSIONS DEEP IN AN > EXPRESSION. > > For example... > > If you had... > songs.append(Song.new(title.gsub!(/_/, ' '), name, mins.to_i * 60 + > secs.to_i)) > > I would ALWAYS refactor that to... > title.gsub!(/_/, ' ') > songs.append(Song.new(title, name, mins.to_i * 60 + secs.to_i)) Which is especially true because gsub! returns nil if no substitutions were performed. Most of the bang methods are really dangerous - but for another reason than widely believed. cheers Simon