Charles Petzold

Software Development Meme

July 4, 2008
Roscoe, N.Y.

Julie Lerman tagged me to answer a few questions that have been circulating.

The Short Version

How old were you when you first started programming?

How did you get started in programming?
College course (1971).

What was your first language?

What was the first real program you wrote?
Probably health insurance claims statistics (c. 1976).

What languages have you used since you started programming?
PL/I, APL, 8080 assembly, Z-80 assembly, MBASIC, CBASIC, 8086 assembly, Turbo Pascal, C, C++, C#, VB .Net.

What was your first professional programming gig?
Getting paid strictly for programming apart from writing has been rare for me until very recently, but in 1988 (I believe) I was paid to write a graphical roulette-wheel for a Fall Comdex (Las Vegas) presentation of the OS/2 Presentation Manager.

If you knew then what you know now, would you have started programming?
Absolutely. Owning a computer without programming is like having a kitchen and using only the microwave oven.

If there is one thing you learned along the way that you would tell new developers, what would it be?
Learn as much as you can because everything fits together.

What's the most fun you've ever had ... programming?
Time-critical interrupt-driven Z-80 machine code for a homebrew digital music synthesizer (c. 1980).

So Who's Next?
I shall tag the three founders of Wintellect: Jeff Richter, Jeff Prosise, and John Robbins.

The Long (Essay) Version

(Portions adapted from a talk I gave to the C++/Java Sig in New York City in May 2005.)

Stevens Institute of Technology — a small engineering and science school in Hoboken, New Jersey — was the first college to require all incoming freshman to take a programming course. In 1971 when I entered Stevens Tech as a freshmen, the course was E11 and the language was FORTRAN IV.

Stevens Tech had a DEC PDP-11 in the basement of the library, along with a bunch of IBM keypunch machines. You typed each statement of your program on a card, and then submitted the deck to the snotty guru behind the counter, who would sometimes riffle through the cards and say "I see a few syntax errors in there, but let's run it through anyway." And sometime later you would pick up a stack of printed paper. If your program was so bad it couldn't run, you'd get a tiny stack. But sometimes if your program ran and ran and ran, you'd get a very tall stack of paper. That was the most embarassing.

There was also a room in the library basement with several teletypewriters connected to the PDP-10 where you could do stuff in real time, but you had to belong to the ACM to use the teletypes, and those guys were strange.

I didn't much like programming then. I had gone to college to be a mechanical engineer. I liked making stuff with my hands, and computing seemed much too abstract for me. I took only two other programming courses in college. One was on numerical analysis using FORTRAN, and the other was a course in assembly language.

The course in assembly language was taught by a math professor, Myron E. White, whose was universally known as Myron Epsilon White. In the year I graduated, Professor White was the recipient of the annual Golden Ream Award — a gruesome-looking large gold-plated screw mounted on a board, which was supposed to symbolize what the professor had done to his students.

There was no textbook available for assembly language programming on the PDP-10 so Professor White had written and published his own, a book entitled Meet Macro-10. I'm not sure what technology he used to publish this book, but a typewriter was definitely involved. Each page looked like a typewritten sheet of 8½ × 11-inch paper. This course is assembly language was totally baffling to me. I think I must have understood that assembly language actually translated to the machine code of the computer and hence was very fast and efficient, but when submitting programs on cards and getting back paper, processing speed was not something you witnessed first hand.

I eventually became a math major and when I graduated in 1975 I moved to New York City and got a job at New York Life Insurance Company as an actuarial student.

Some of the younger actuaries programmed, and new actuarial students were expected to program as well. The actuaries coded in FORTRAN using punched cards on an IBM 1130 — a castoff computer from an earlier time. The company's main computer was a big IBM 370, and within a couple years non-IT people like myself also got access to the 370 via a terminal system called Time-Sharing Option or TSO.

New York Life was one of the few major financial institutions that didn't do COBOL. New York Life was a PL/I shop. By this time, I was liking programming a lot better than in college, partially because I was getting pretty good at it, and also because I could make and correct my own syntax and runtime errors in the privacy of my own terminal, thank you. No more snotty gurus behind the counter riffling through card decks.

PL/I was a glorious language. It had a little something for everybody. You could do reports in PL/I but you could also do hard-core science and engineering programming. There was a FIXED DEC data type where you specified the number of decimal places. The math library was very rich. The DO loop was particularly versatile (and I may not have the syntax entirely correct but you'll get the idea):

To this day I encounter problems where I think "I'd really like to use the PL/I DO loop for this." You could also put these loops right in your WRITE statements.

Meanwhile, at home, I was working with my hands. I had an interest in electronic music (beginning with the 1968 release of Switched On Bach) and by about 1977 I had started building electronic music instruments out of CMOS chips. With the help of a couple books (Don Lancaster's "cookbooks" were instrumental) I had taught myself digital logic circuitry, and I was wiring up chips with a wire-wrapping gun to make little electronic-music sequenzers. I had seen Philip Glass's Einstein on the Beach at the Metropolitan Opera House in 1976, and an early performance of Steve Reich's Music for 18 Musicians (and other works) at The Kitchen around that time, and I really liked the idea of creating repetitive music. Except I didn't want to play it — I wanted a machine to play it for me.

After building two sequencers, I remember designing a third where I'd have certain codes in memory that would govern how notes stored in other parts of memory would be retrieved and moved around and repeated, and how the individual bits of these codes would trigger other chips, and I suddenly thought "I bet this is how computers work!" It was an epiphany the likes of which I have never ever experienced.

This was sometime in 1978, I believe, and I knew there were chips called microprocessors, but I hadn't really looked at them because they had seemed like overkill for what I was doing. Suddenly they seemed ideal. I realized that having a microprocessor at the center of an electronic music synthesizer would be very beneficial. At that time there were two major 8-bit microprocessors available for hobbyist use: the Intel 8080 and the Motorola 6800.

The Barnes & Noble store on 5th Avenue and 18th Street (the very first Barnes & Noble store) had a good selection of technical books, but I think they happened to be sold out of books about the 6800 at the time I checked. Instead I gravitated towards the 8080, the beginning of a life centered around Intel architecture. I sometimes wonder how my life would have been different if the Barnes & Noble had a good book about the 6800 in stock at the time.

After my hands-on experience with digital logic design, 8080 assembly language was a snap. It was obvious to me exactly what every instruction did in terms of gates and registers.

Around 1979 I started building a computer-controlled digital electronic music synthesizer. It took about two years and was based on a block diagram in an article in the Computer Music Journal, Vol. 1, No. 2 (April 1977) entitled "Design of a Digital Oscillator which will Generate up to 256 Low-Distortion Sine Waves in Real Time" by John Snell. I ended up using the Zilog Z-80 microprocessor which was binary compatible with the 8080 but also supported additional instructions such as indexed addressing that I found very handy.

The computer part had 64K of dynamic RAM, with another 64K accessible sequentially through an I/O port. The synthesizer part was entirely TTL (for speed). It generated not the 256 sine waves promised by John Snell but 80 sine waves in real time, with separate envelopes for frequency and amplitude, combined in pairs in simple frequency-modulation (FM) synthesis, so I got 40 simultaneous voices. I built everything myself except for one 4K static RAM board. The machine had a five-octave music keyboard, and a regular keyboard and video display capable of 16 lines of 32 characters, which basically let me type hexadecimal bytes into memory.

The software system controlling the synthesizer was entirely interrupt driven, and the machine code had to be as efficient as possible. As I coded, I literally counted clock cycles, and I soon memorized the length of each instruction. I would code and recode, shaving a cycle here and a cycle there.

After it was completed in 1981, I was able to program entire music compositions and play them back, and I spent about a year doing this until it became very, very clear that I had no talent at all for composing music. But it was fun and obviously a valuable learning experience. (Without this experience there obviously would have been no Code: The Hidden Language of Computer Hardware and Software.)

Sometime in the future I'd like to post some photographs and documents about this computer-controlled digital synthesizer, and even some of the "music" I wrote.

About 1982 I bought an Osborne I, which ran CP/M on a Z-80. The simple reason I bought an Osborne rather than an IBM PC was because the Osborne was $2,000 and the IBM PC was $5,000. About the same time, New York Life got some IBM PCs, and I picked up 8086 assembly language fairly quickly as well.

I finally bought a two-diskette $5,000 IBM PC early in 1984. It wiped out two credit cards, so I decided the machine needed to pay for itself. I wrote an article about ANSI.SYS and the PROMPT command, sent it to PC Magazine and they sent me $800. It was the first time I had ever been paid for something I wrote.

In the summer of 1984, PC Magazine was doing the first of what became an annual roundup review of printers, so they called all the people who had written for PC Magazine who lived in the New York City area and asked them to come in to the office to review printers. The PC Magazine offices were at One Park Avenue just a few blocks north of the New York Life offices at 51 Madison Avenue, so it was very convenient for me. I reviewed printers and also started showing people at the magazine some small assembly-language programs I had written. I was soon writing little 300-500 byte .COM file utilities for PC Magazine

By the summer of 1985 I was getting so much freelance work from PC Magazine that I was able to quit my job at New York Life Insurance. I haven't had a real job since.

I think I learned C in 1984 or 1985. I know that I was pretty familiar with C when I started working with the beta Windows SDK in 1985. Another fortuitous connection occurred: Jonathan Lazarus was a VP at Ziff-Davis (which published PC Magazine) at the time, and he was very enthuiastic about Windows. Jon left Ziff and contracted with Microsoft for his consulting firm (H. Roark & Associates!) to publish a Windows programming magazine. But they chickened out and decided that Microsoft Systems Journal would cover both DOS and Windows programming. Jon knew a few PC Magazine authors so he recruited us to write some articles. I wrote the article "A Step-by-Step Guide to Building Your First Windows Application" for MSJ, Vol.1, No. 2 (December 1986) which I believe was the first article about Windows programming to appear in a magazine.

This early connection between PC Magazine and Microsoft Systems Journal continued for several years. Editors and writers from the two magazines would often socialize together, both in New York City and at industry events such as Comdex.

At some Microsoft-related function in 1986 I told Tandy Trower how much fun I was having writing articles about Windows programming for MSJ. When Microsoft Press editor-in-chief Susam Lammers asked Tandy if he knew anybody who could write a book about Windows programming, my name came up, and Susan gave me a call. As I result, I was contracted to write a book and I wrote the first edition of Programming Windows from January through August 1987.

I think from that point my programming career has been somewhat more conventional....