--------------050503050103080004070205 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit James Edward Gray II wrote: > On Apr 9, 2006, at 8:59 AM, Joern Dinkla wrote: > >> I programmed it to learn Ruby and to improve my coding skills, >> because i have less than 2,5 weeks of experience with Ruby. I bought >> the Programming Ruby" book by Dave Thomas et. al. and started to >> read it two weeks and two days ago and i used it a lot the last 48 >> hours. I think there are some parts of the code where there are >> better solutions or could be better expressed in a more "rubyish" way. > > > For debugging statements like: > > if ( $VERBOSE ) > puts "Calculating probabilities ..." > STDOUT.flush() > end > > I like to use the $DEBUG variable. You can toggle it on and off with > Ruby's -d command-line switch. Thanks for the hint. But i do want a difference between debug output and verbose output. Debug output is for the developer and the verbose output for developers and users, so that the user can observe what is going on. I did not know about the -d switch. Thanks. > The call to flush is also not needed: > > puts "Calculating probabilities ..." if $DEBUG It's not strictly needed, yes, but when i did the tests i wanted to get the output as fast as possible, because i wanted to observe the performance and if i did not flush the buffer the output printed out at once at the end of the program (after it finished). Maybe this is because i used the Ruby Development Tools for Eclipse. I have to check this if the behaviour is the same on the command line. > Hope that helps. > > James Edward Gray II > Best regards, Joern -- Joern Dinkla, http://www.dinkla.net --------------050503050103080004070205 Content-Type: text/x-vcard; charset=utf-8; name oern.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename oern.vcf" begin:vcard fn;quoted-printable:Jörn Dinkla n;quoted-printable:Dinkla;Jörn adr;dom:;;;Hamburg email;internet:joern / dinkla.net tel;cell:+49(0)179 70 10 60 5 x-mozilla-html:TRUE version:2.1 end:vcard --------------050503050103080004070205--