Charles Petzold on writing books, reading books, and exercising the internal UTM

Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

Public Code

October 30, 2005
Roscoe, NY

What I do for a living is write code that appears in books and sometimes magazine articles. Sometimes the code isn't quite correct. Every programmer knows that a few bugs here and there are to be expected.

But sometimes the code is very public and very wrong.

In 1985, PC Magazine decided to do a cover story on programming languages. (That would be unthinkable for PC Magazine these days.) Nineteen compilers were reviewed. I wrote about assembly language, Jeff Duntemann tackled Pascal, Kaare Christian did C, and there were also reviews of Basic and Cobol compilers.

After we had all handed in our copy, Executive Editor Paul Somerson telephoned and told me they wanted to do a cover with two guys talking to each other, except that they'd be talking in two different programming languages. They already had four lines of Cobol for the one guy, and could I write four lines of business-related Pascal for the other guy? I worked on it for about 20 minutes, called Paul back, and carefully read him the lines of code over the telephone.

A few weeks later, the magazine came out. "Real Businessmen Program!" was the cover story of the October 29, 1985, issue, and sure enough it showed two guys speaking Cobol and Pascal. (I had recently left New York Life Insurance Company, and could have told anyone at PC Magazine that the corporate IT department there probably had as many women programmers as men, but the PC industry was very sexist in those days.) I thought it was very cool that I had written some code — inconsequential to be sure, but code nonetheless — that appeared not in the pages of PC Magazine but on the very cover. There it was:

     for i:=1 to 12 do begin

And with a bolt of horror and shame it hit me: The code was wrong. It showed arrays being indexed with parentheses rather than square brackets.

Frantically, I tried to find some way the code could be correct. The income and expenses could be functions rather than arrays, but profit couldn't be a function. No, the code was defniitely wrong.

I had no idea what would happen. The readers of PC Magazine loved bringing technical errors to the attention of the editors. They'd undoubtedly write numerous letters scolding the magazine for the blatant gross error, and then it would get back to me. At best, I'd be humiliated. The worse scenario involved the end of my career in computer journalism.

Every newstand I passed added to my misery. There it was, in plain site for all to see. Pascal code I wrote that was outrageously wrong.

For two weeks this went on, until the new issue of PC Magazine came out, and I could begin trying to suppress the memories of this sorry episode. I was surprised that nobody at the magazine had yet mentioned anything to me, but I wasn't about to bring it up.

A couple months later I was cleaning my apartment and came upon a little piece of paper on which I had written the code I read over the phone to Paul Somerson. My code had square brackets! And if the code I wrote had square brackets, I must surely have read them as brackets. It wasn't my mistake. It was somebody else's mistake.

At this point, I felt brave and secure enough to find out what happened. The next time I saw Paul Somerson I asked him if anybody had written to the magazine about the Pascal code on the cover. No one had. I then told him the code was wrong. There should have been square brackets instead of parentheses. He shrugged and didn't seem concerned, and offered the simple theory that the art department must have typed the code on a typewriter when pasting up the cover. Of course, typewriters didn't have keys for square brackets, so they simply substituted parentheses.

Did anybody else notice the mistake? If so, they kept it to themselves.

Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

(c) Copyright Charles Petzold