[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Non-declared variables

Gavin Kistner

10/16/2006 5:04:00 PM

From: ara.t.howard@noaa.gov [mailto:ara.t.howard@noaa.gov]
> it's not the actual typing of the lines that takes so long -
> it's reasoning over it.

...and yet (for me) the actual typing of the lines *is* a significant
portion, even though I'm a reasonably fast typer. I just performed a
simple test to be sure.


It took me 45 seconds to type (the Ruby code):
myArray.each{ |a,b|
alert( a, b )
}
five times in a row.

It took me 60 seconds to type (the JS code):
for ( var i=0, len=this.length; i<len; ++i ){
alert( this[0], this[1] );
}
five times. I type that loop ALL THE TIME. My muscle memory is attuned
to that loop, and cranks it out.

It took me 65 seconds to type (the JS code):
myArray.each( this, function( a, b ){
alert( a, b );
} );
five times. And, I made a typo on the fourth attempt that I didn't see
until I was done.


This is obviously a very simple test, but I'm telling you that, in this
case, saving keystrokes reduces my programming time on a task by 25%. I
write JS all day long, and I cringe every time I need to iterate an
array. (Cringing time not included in the above measurements.)