On 7/15/07, Chad Perrin <perrin / apotheon.com> wrote: > On Sun, Jul 15, 2007 at 08:40:10AM +0900, Robert Klemme wrote: > > > > With regard to premature optimization: I just made it a habit to use > > chomp! in this case because I dislike creating an object that is > > immediately thrown away when I can avoid it easily. I'm not religious > > here - it's just my personal rule of thumb. As I said "inplace > > modification" is nothing special, it's just the normal OO way of doing > > things: object state changes. Maybe people tend to forget that String > > and Fixnum are objects just like any other object (ok Fixnum is > > immutable and immediate but that's about it) and maybe that's the reason > > why they feel that inplace modification is special or bad. Dunno. Chad > > mentioned issues that can arise in complex code from inplace > > modification and took that as his personal guideline to avoid it. I > > have a different personal guideline... > > My personal guideline is basically to avoid in-place modification unless > I have specific reason to use it. I find that an approach more > reminiscent of functional style lends itself to readability as well as > technical benefits for complex code, generally -- and when it doesn't, > that qualifies as "specific reason to use" in-place modification. Yeah Robert, that was my feeling and that's what I really wanted to discuss, sorry if I got too offensive. I know I often forget the "?" when asking questions. :( After some thoughts I just have to say that Chad seems to make his life easier than I make mine and I will consider his style in the future too. Conclusion, as this seemed to be quite a simple question, there are no simple questions ;) > > I guess there's a sort of fuzzy area in the middle where one tends to > lean one way or the other, based on personal preferences. Yup and that's the interesting stuff > > -- > CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] > Amazon.com interview candidate: "When C++ is your hammer, everything starts > to look like your thumb." Hey I never read this one, GREAT!!! > > Robert -- I always knew that one day Smalltalk would replace Java. I just didn't know it would be called Ruby -- Kent Beck