?

Log in

No account? Create an account

August 7th, 2006

Bleah :P

Back at work again. That, while never my favorite thing to say, wouldn't be so bad in and of itself, except that this morning I woke up from another rather bleak dream and so I'm in a funk.

My dreams have tended to have this morose streak in them lately, and I wish they'd knock it off. There's always somebody accidentally fracturing their spine or falling down the stairs or something like that. It's generally not me personally who's getting abused by life, but it's still stressful 'cause I'm usually running around trying to convince all the blasé bystanders to "Call an ambulance, for God's sake!" or "Help me put out this stupid fire already!" or "Get some bandages, this guy's been shot! GET SOME #&*$^ BANDAGES!" and they just can't be bothered.

I'm sure summer has a lot to do with it. Hopefully things will improve in 45 days or so.

Meanwhile, back to the grind.

-The Gneech

Objection-Oriented Programming

One of the problems with getting training is it makes you think back to previous projects and wince at your rotten code. So today, I had a request to modify a report I wrote in 2002/2003 or so ... huzzah! A perfect excuse to go back and clean up the code!

In the spirit of OOP and code modularity, I did at least build the page originally so that all the reports had the same output page that I could use over and over again. The new request, however, only wanted half of the data that the previous reports did. Ack!

The first step was to add a LOT more documentation -- and more helpful documentation than "--start HTML code--" "--end HTML code--". The second step was to pull all the stored procedures out of the main page, shove them off to an include file where they could all be seen in one place, and change from an "if/then/else" structure to a "switch/case" structure.

An interim step was to pull out code that tested on the value of "form.submit" -- because there is a bug in IE 6 (I think it is) that doesn't send the value of "form.submit" if the user hits the enter key rather than clicking on the button. (We discovered that one through a lot of head-banging and hand-wringing, believe you me!) Instead, we'll use a hidden variable ('requesttype') to determine which report to run, thankyouverymuch.

The final step, and this was the neat bit I thought, was for each request type to set up a list of which columns to include in the output, and in the output code to test on whether that column is in the list. So now this report is infinitely extensible -- if they add a new type of report that tracks a new data point, all we have to do is put a new column in the list.

It's all pretty basic stuff, really, but it was stuff I hadn't learned (or at least really grocked) yet when I first built the report. As time goes by and new changes to older sites come in (as they inevitably do -- the older and more forgotten a site is, the more likely somebody will shriek "OMG WE GOTTA MAKE THIS CHANGE RIGHT NOW!!!" at me when I come ambling in some morning), I plan to keep doing this pruning-and-updating process. Regardless of how I may feel about a given contract, I can at least take pride in my craftsmanship about it.

-The Gneech

Latest Month

November 2019
S M T W T F S
     12
3456789
10111213141516
17181920212223
24252627282930

Tags

Powered by LiveJournal.com
Designed by Tiffany Chow