From: Marcel Ward Date: 2007-04-10T02:00:09+09:00 Subject: Re: Getting to 100 (#119) On 09/04/07, Rick DeNatale wrote: > On 4/9/07, Marcel Ward wrote: > > For the same number of lines, I find the second much easier to follow > > without having to remember any state for the second time around. > > There does not seem to be any advantage in placing the asterisk lines > > together. (?) > > > Not quite the same I think. I wrote it the way I did to cover the > (admittedly probably rare case where two solutions occur one after > the other. That's why the variable found_in_a_row is there. > > I wanted to see: > > ******** > xxxxxx = 100 > yyyyyy = 100 > ******** > > instead of > > > ******** > xxxxxx = 100 > ******** > ******** > yyyyyy = 100 > ******** Aha, thanks for clarifying. I think this would be a prime candidate for a comment. Before someone else gets their mits on the code and starts refactoring inappropriately (like me). > > As another aside, I'm in two minds as to whether it's necessary to > > provide such a complete set of parameters (and comments) for these > > solutions. On the one hand it sets a good example to newcomers (and > > it satisfies our quest for perfection) but on the other it does tend > > to obscure some of the more interesting details. It's like you're > > damned if you do and damned if you don't - the difficulty is finding > > the right balance. > > > > I think there's room for both kinds of posts but certainly the shorter > > ones seem more appealing even if longer ones do use the same > > underlying methods. I also like to work at making a solution more > > generic for future purposes but I've come to the conclusion that > > (unless the extra credits mention it) there's no point because I'm > > only going to prejudice my solution. > > > > In the real world I would go for the more generic code and proper > > comments any day but for the purposes of the quiz I like to see > > solutions that do just as much as is asked of them and ideally fit on > > one page of my screen. > > I see it as an opportunity to document my thoughts in solving the > quiz, and thereby teach myself and others. The best way to learn is > to teach. I can't disagree with that - it's been my theory up until now but I have no idea how useful it's been to others. If I'm just turning people away with long posts then I'd prefer to shorten them down to meet the audience's expectations better. > And, Frankly, I'm kind of an anti-golf advocate, except when I have a > club in my hands instead of a keyboard at my finger-tips. > > Finally I figure that it's JEG II's choice as to how to summarize the solutions. > > Chacun a son go�t! I'm definitely in favour of comments and readability. I guess I was just verbalising some inner thoughts and wondering how others try to find the right balance. -- Marcel > -- > Rick DeNatale > > My blog on Ruby > http://talklikeaduck.denhaven2.com/ >