Monday, December 31, 2018

Improving the Classics

I looked at some IBM assembler code from ~ 35+ years ago (support for some FORTRAN games ported from MUSIC to IBM VM/CMS). While it worked fine, it truly offended me. In particular, I felt driven to rewrote 32 lines into 9. (The 9 lines doesn't count the pair of simple FORTRAN programs I wrote to test the routines BEFORE I modified them. THAT's something I've learned to do since 1980 ....) Looking at the old code, I'm reminded of Cargo Cult Programming -- the old code did the right things, but it was redundant and did things by hand that macros could do for the past fifty years. It was all as if the coder didn't really grasp what they could do ... I'm sure I've seen and probably touched the code before, but I never wrote code this ugly -- I know, as I've got code samples from the era this was written, and I if nothing else I didn't code stuff by hand that macros existed for. I've also commented my code better since I was a freshman. (My old schoolmates would beg to differ about a help script I wrote for the Clarkson ROSCOE time sharing system. It was labeled as "Funky Subroutine #20", which none of us could decipher a few weeks later, wasn't deliberately obfuscated, but it was dense, like an APL one-liner -- write only code. Hey, it worked.)