On Tue, 2005-01-25 at 20:28 -0500, Kevin Murphy wrote: > Sam Watkins wrote: > [snip] > > This is a pretty typical use of Perl. Note that the regular expression > given, while legal, might not normally be written as it is, but more > scarily as "/^\s+([^(]+)\s+\((\d+)/". Non-Perl coders will See, line noise!!! > unfortunately be mystified by several perlish shortcuts, namely the > magical DATA filehandle, which reads from the source code starting at > the __DATA__ line, the magical <FILEHANDLE> operator, the important but > invisible $_ variable, and the magical $a and $b variables in the custom > sort function. All these bits of magic are considered Features, and It's this magic that makes things hard to maintain. For example, you write a program that, for example, sets $_ in line 100 and uses it in line 105. Later, someone takes your code and modifies/tweaks it to their needs. One of the things he does is add a line in at 104 that has the side-effect of modifying $_. Bug!!! Implicit variables make for short, small Q&D programming, but are a maintainability land mine. "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan You never know when a one-off q&d little script will wind up lasting forever, growing and metastasizing. So, even one-off q&d should be written "non-cleverly". Thus I have spoken, thus it shall be. :O -- ----------------------------------------------------------------- Ron Johnson, Jr. Jefferson, LA USA PGP Key ID 8834C06B I prefer encrypted mail. "Whatever may be the moral ambiguities of the so-called demoratic nations and however serious may be their failure to conform perfectly to their democratic ideals, it is sheer moral perversity to equate the inconsistencies of a democratic civilization with the brutalities which modern tyrannical states practice." Reinhold Nieburhr, ca. 1940
Attachment:
signature.asc
Description: This is a digitally signed message part