A recent peeve of mine has been not just what comments say, but what one names the variables. This, IMHO, is just as important as meaningful comments -- perhaps even more so. Check this out:
Even though this snippet is my own that I just altered extremely to provide example, when I saw very similar code in another script when I was just starting out in perl, it proved that variable names -do- matter, and -do- provide insight into the program's workings. It doesn't have to be ugly, tho:# handle CTCP {LOOK,OGLE} sub _lookpm { my $boo=shift(@_); my @x=split(/ /,$boo); my $y=(split('!',$x[0],2))[0]; my $z=IRC::get_info(3); my $man=IRC::get_info(1); my $booya=$x[2]; . . .
. . . and it's still debatable as to the usage of some of these vars. I'll have to work on cleaning it up. :o)# handle CTCP {LOOK,OGLE} sub _lookpm { my $line=shift(@_); my @pargv=split(/ /,$line); my $who=(split('!',$pargv[0],2))[0]; my $serv=IRC::get_info(3); my $nick=IRC::get_info(1); my $context=$pargv[2]; . . .
Which would you rather have the pleasure of trying to understand?
--
Me spell chucker work grate. Need grandma chicken.
In reply to Re: Danger, danger Will Robinson (documenting code)
by yakko
in thread Danger, danger Will Robinson (documenting code)
by jepri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |