I spent this weekend doing 'home improvement' projects. You know, the sort of thing where 'measure twice, cut once' ends up saving your @ss more than once. In my case, 'measure
many' would be more appropriate, since I still screwed up more times than not. =8^%
It got me to thinking about programming in general, and how often I rely on
^w to hide my sins. Am I really brilliant, or do I just cut things many, many, many times while relying on the fact that I can run it again and again without being found out?
<red>
I was just whacking a simple CGI to replace an old Korn shell routine with one that would build an e-mail attachment from a data set as an .xls file, and the shell script didn't have any ¶m=value sets, only space-delimited values. I went around and around with $q->param and $q->keywords and perldoc CGI, trying to figure out why
#! /usr/bin/perl
use warnings;
use strict;
use CGI qw/:standard/;
my $q = new CGI;
my @a = $q->param('keywords');
print $q->header;
print $q->start_html('Export Data to Spreadsheet Format');
foreach $a (@a) { print $a . "\n"; }
my $s = @a;
print "$s\n";
print $q->end_html;
gave me back one string on one line. Now, of course, all youse script kiddie geniuses out there immediately pounce on me and say "Doofus! you need to use
<BR> tags to separate lines in HTML!" And, of course, I know that, too. My point isn't to show the finer nuances of HTML formatting and CGI.pm, it's to laugh at my own ability to go round the mulberry bush waaay too many times before I sit down and think about what I'm doing.
But then, looking at the neat stuff I do create in oh-so-many different application areas, I have to give myself a little credit. Yes, I use the delete key a lot more than I use the structured analysis portion of my brain. Truth is, most often the SA part of my brain is more focused on the bigger picture of what I'm trying to create than on the nit-picky details of how it gets done, and I don't want to bail out of my cloud just to see if it's raining down below. Yes, I lost ten minutes to a silly mistake, but, when considering that I'm decoding and updating a web system designed and implemented a long time back in languages I don't use by somebody who's too busy to explain (or remember) it now, that's a small price to pay.
So, I guess I'm not so red-faced after all, when thinking of my programming style. It's not like I'm still coding in the Dark Ages of overnight batch jobs and punch decks. I certainly wouldn't last long as a nurse in a cardiac ward or as a cabinetmaker, but, as a programmer who gets thrown a lot of the challenges others duck, I do all right. It's just that sometimes my socks don't match...
:D