Coding Horror

programming and human factors

Everything I Needed to Know About Programming I Learned from BASIC

Edsger Dijkstra had this to say about Beginner's All Purpose Symbolic Instruction Code:

It is practically impossible to teach good programming style to students that have had prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

I'm sure he was exaggerating here for effect; as much as I admire his 1972 "The Humble Programmer" paper, it's hard to square that humility with the idea that choosing the wrong programming language will damage the programmer's mind. Although computer languages continue to evolve, the largest hurdle I see isn't any particular choice of language, but the fact that programmers can write FORTRAN in any language. To quote Pogo, we have met the enemy, and he is us.

Dismissing BASIC does seem rather elitist. Like many programmers of a certain age, I grew up with BASIC.

I mentioned in an earlier post the curious collision of early console gaming and programming that was the Atari 2600 BASIC Programming cartridge. I had to see this for myself, so I bought a copy on eBay.

Atari 2600 basic programming cartridge

I also bought a set of the Atari 2600 keypad controllers. The overlays come with the cartridge, and the controllers mate together to make a primitive sort of keyboard. (Also, if you were wondering what kinds of things I do with my ad revenue, buying crap like this is a big part of it, sadly.)

Atari 2600 BASIC programming keypads

Surprisingly, the manual isn't available anywhere online, so I scanned it in myself. Take a look. It's hilarious. There is a transcribed HTML version of the manual, but it's much less fun to read without the pictures and diagrams.

I booted up a copy of the Basic Programming ROM in the Stella Atari 2600 emulator, then followed along with the manual and wrote a little BASIC program.

Atari 2600 BASIC Programming Screenshot

You'll notice that all the other screenshots of Atari 2600 Basic Programming on the web are essentially blank. That's probably because I'm the only person crazy enough to actually try programming in this thing. It may look painful, but you have no idea until you've tried to work with this funky "IDE". It's hilariously bad. I could barely stop laughing while punching away at my virtual keypads. But I have to confess, after writing my first "program", I got that same visceral little thrill of bending the machine to my will that I've always gotten.

The package I got from eBay included a few hand-written programming notes that I assume are from the 1980s.

Atari 2600 sample code

Isn't that what BASIC – even this horribly crippled, elephant man Atari 2600 version of BASIC – is all about? Discovering fundamental programming concepts?

Of course, if you were at all interested in computers, you wouldn't bother programming on a dinky Atari 2600. There were much better options for gaming and programming in the form of home computers. And for the longest time, every home computer you could buy had BASIC burned into the ROM. Whether it was the Apple //, Commodore 64, or the Atari 800, you'd boot up to be greeted by a BASIC prompt. It became the native language of the hobbyist programmer.

basic on the Apple // series

basic on the Atari 8-bit series

basic on the Commodore 64

Even the IBM PC had BASICA, GW-BASIC and finally QBasic, which was phased out with Windows 2000.

It's true that if you wanted to do anything remotely cutting-edge with those old 8-bit Apple, Commodore and Atari home computers, you had to pretty much learn assembly language. I don't recall any compiled languages on the scene until the IBM PC and DOS era, primarily Turbo Pascal. Compiled languages were esoteric and expensive until the great democratization of Turbo Pascal at its low, low price point of $49.99.*

Even if you lacked the programming skills to become the next David Crane or Will Wright, there were still a lot of interesting games and programs you could still write in good old BASIC. Certainly more than enough to figure out if you enjoyed programming, and if you had any talent. The Creative Computing compilations were like programming bibles to us.

BASIC Computer Games More BASIC Computer Games

For a long, long time, if you were interested in computers at all, you programmed in BASIC. It was as unavoidable and inevitable as the air you breathed. Every time you booted up, there was that command prompt blinking away at you. Why not type in some BASIC commands and see what happens? And then the sense of wonder, of possibility, of being able to unlock the infinitely malleable universe inside your computer. Thus the careers of millions of programmers were launched.

BASIC didn't mutilate the mind, as Dijkstra claimed. If anything, BASIC opened the minds of millions of young programmers. It was perhaps the earliest test to determine whether you were a programming sheep or a non-programming goat. Not all will be good, of course, but some inevitably will go on to be great.

Whether we're still programming in it or not, the spirit of BASIC lives on in all of us.

* as an aside, you may notice that Anders Hejlsberg was the primary author of Turbo Pascal and later Delphi; he's now a Technical Fellow at Microsoft and the chief designer of the C# language. That's a big reason why so many longtime geeks, such as myself, are so gung-ho about .NET.

Written by Jeff Atwood

Indoor enthusiast. Co-founder of Stack Exchange and Discourse. Disclaimer: I have no idea what I'm talking about. Find me here: http://twitter.com/codinghorror