Compare the ‘HACK’ portion of the code with an equivalent and render your own judgment. Well, revisiting my old code, sticking with the community of fellow monasterians, and reading various articles/books on proper software coding practices made me rethink a lot of old notions and ideals I once cherished and now came to despise. Having had to maintain my old code and deal with seemingly childish ‘hacks’, I became increasingly frustrated by any mentioning of the word ‘hack’ in the context of programming (especially Perl). In my conversations with fellow developers, I try to use the word with extreme caution and very very seldom. I’m trying to be careful not to excite any other developer (especially junior type) into writing a lot of ill hacks that I might eventually have to deal with later in my work.# HACK # see if current time field value exceeds its maximum (reminder of % o +peration is greater than 0); # if true, add reminder to ($time_date[$i+1], $time_date[$i]) = ($time_lim != -1 && ($rem = $time +_date[$i]%$time_lim)) ? (($time_date[$i] - $rem) / $time_lim, $rem) : + ($time_date[$i+1],$time_date[$i]); # equivalent (not HACK)... # if ($rem = $time_date[$i] % $time_lim) { # $time_date[$i+1] += ($time_date[$i] - $rem) / $time_lim; # $time_date[$i] = $rem; # }
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=<a HREF="/index.pl?node=%22ps%20-e%20-o%20pid%20"> "," $2 </a>;`@$_ +`?{print"+ $1"}:{print"- $1"}&&`rm $1`; print$\;}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Please 'hack' nicely...
by Biker (Priest) on May 23, 2002 at 13:36 UTC | |
Re: Please 'hack' nicely...
by Molt (Chaplain) on May 23, 2002 at 13:24 UTC | |
by dsheroh (Monsignor) on May 23, 2002 at 22:45 UTC | |
Re: Please 'hack' nicely...
by webfiend (Vicar) on May 23, 2002 at 13:43 UTC | |
by Biker (Priest) on May 23, 2002 at 13:56 UTC | |
by mirod (Canon) on May 23, 2002 at 19:45 UTC | |
by Aristotle (Chancellor) on May 24, 2002 at 05:13 UTC | |
Re: Please 'hack' nicely...
by Aristotle (Chancellor) on May 24, 2002 at 05:10 UTC | |
Re: Please 'hack' nicely...
by mpeppler (Vicar) on May 24, 2002 at 00:58 UTC | |
Re: Please 'hack' nicely...
by hakkr (Chaplain) on May 24, 2002 at 11:28 UTC |