Feb 08 2010

Programming Is Fun Again

Unlike a lot of the people of my generation who got into computers and programming, I didn’t grow up with one.  Home computers were still kind of an oddity then, and the price tags made them seem about as accessible to me as having my own jet plane.  So my first programming experiences were fairly short and pointless: some character graphics stuff on Apple systems at College for Kids at QU; fiddling with Pascal on a visit to Purdue when I was 16; and finally some real Z-80 programming on the Sanyo CP/M machines we got at St. Thomas in my senior year.  Computer class focused on word processing in Wordstar and saving our work to disk, but somewhere I managed to run down some info on the Z-80s registers and assembly language, and did some simple programming like a tic-tac-toe game.  I even remember programming on paper, writing out the lists of instructions that I’d type in later when I got access to the systems again.

Not long after I went away to college and then dropped out, I met some guys who had Commodore systems—and lots of software for them—and I had to have one.  I went to Sears and ponied up about $700 for the Commodore 128DCR and an RGBi monitor (which still worked 20 years later when I sold it on eBay).  I spent a lot of time playing games copied from friends, but I did a fair amount of progamming too.

The thing about programming then was: it was hard.  There was no Internet, and the Q-Link network that worked with Commodore systems was a long-distance number and out of my price range.  So the only information you could get about how to program the thing was in books and magazines—no sharing ideas and programs with other coders on any faster than a monthly basis.  I had the C128 and 1571 programmer’s reference guides, and had large chunks of them memorized.  The programming tools were pretty primitive too.  The C128 had Basic 7.0, and unlike the C64 it did have a machine language monitor, which helped a lot.  I eventually got an ANSI C compiler, and even did some stuff in the 128′s CP/M mode, as it happened to have a Z-80 processor (which about a dozen people ever used).  But programming still consisted mainly of sticking numbers into CPU registers and memory locations and doing binary arithmetic.  That meant you needed to know the purpose of thousands of different addresses, or at least have them in a handy reference to look them up.  It was painstaking and precise work, and you could get a thrill out of something as simple as drawing a circle on the screen, after spending hours coding it.

And yet it was fun.  I got to playing around with the 80-column chip on the C128, which Commodore said was only good for text displays.  Well, the book said it had a graphics mode you could switch on, and there were a couple programs out there that used it, so I gave it a shot.  To draw on it, you couldn’t write directly to the video memory; you had to go through a handshaking process where you talked to the video chip and passed it commands and values one at a time, like “Ok, I’m about to send you an address.  Let me know when you’ve got it.  Ok, now here’s a value to put at that address.  Let me know when you’ve done that.  Ok, now move to the next address….”  And so on.  I was pretty pleased with myself when I got it to randomly display blinking dots all over the screen like stars in the sky.

Once I got online, I dived into Unix shell programming, which was a real treat—you mean I can run multiple programs at once, passing the results from one as input to the next, and make these chains as complex as I like?  Awesome!  That led to more C and eventually Perl, which quickly became my language of choice.  The motto of Perl is TMTOWTDI (There’s More Than One Way To Do It; I wish that would fit on a license plate), and it really is a Swiss army knife sort of language.  It lets you decide for yourself how you want to do things, and it doesn’t force you to write any more code than necessary.  I took to Perl like a duck to water, and started writing CGI programs for web sites in it.

Then something happened: it stopped being fun.  I still liked the language, but the work wasn’t challenging anymore.  Almost all web programming consisted of taking input from forms, checking it a dozen different ways to make sure it was valid and harmless, and then producing output from it.  Only the details changed from program to program.  Once you know how to do it, it’s just repetition.  If you dig a ditch two feet deep today and three feet deep tomorrow, you’re still digging a ditch, and you’re not likely to get excited about the change in depth.  Processing yet another different form was the same way.

What made it worse was HTML, the markup language web pages are written in.  Not long after I started writing CGIs, the web browsers started supporting tables and font styles, and HTML went bonkers.  Soon every site had elaborate structures based on dozens of tables nested within each other, and a page with a hundred actual visible words on it and a couple images might have tens of thousands of characters of HTML markup laying it all out.  Sorting through all that and making changes without throwing off a table cell somewhere was mind-numbing and frustrating.  It wasn’t unusual to spend more time trying to get the HTML to display right than to do the coding that produced the actual content.

So I continued doing that kind of work when it came up because it paid the bills, but I never liked it much.  I’d jump on any system administration or networking jobs that came along, but the web stuff is a lot more plentiful.  Lately, though, I’ve realized the web work is getting fun again.  HTML and CSS have matured to the point where there’s a clear divide between a page’s content and its layout and styles.  The jQuery library for Javascript makes dynamic activity on the page a breeze, and eliminates a lot of the cross-browser incompatibilities that make web programming such a pain.  Ajax (which jQuery makes extremely easy to use) eliminates the need to reload the entire page every time you want to do some little thing.  On the server end, Mason extends the power of Perl to make web apps easier and more modular.  Even PHP has improved to the point where I can program in it for up to an hour sometimes without cussing.

Thanks to all those things, I’m having fun programming on the web again, and starting to look toward new projects with anticipation instead of boredom.  Even web design, which I used to refuse to do at all, is pleasant now that the code can be clean and divided sensibly according to purpose.  I’ve used some very simple jQuery tricks on our webmaster page to do things like toggle the FAQ entries on and off, open off-site links in a new tab or window, and fade out a fixed image when you scroll down the page.  (That last thing’s pretty gimmicky, but I think it’s kinda neat, so I’m keeping it for a little while.)  Those were very simple, but as I do more complicated tasks, I’ll talk about them here.  It’s really nice to be enjoying this stuff again.

If you enjoyed this article, why not rate it and share it with your friends on Twitter, Facebook, or StumbleUpon?

GD Star Rating

WordPress Themes