If you’d like to hear a boring but heart-warming story, ask a geek about how they learned programming. It’s like the opposite of trolling: you can instantly provoke tearfully-joyous nostalgia out of programmer strangers on the Internet by making this inquiry. Most of these stories will include some form of a programming language called BASIC, the Beginners All-purpose Symbolic Instruction Code created in the 1960’s at Dartmouth. The Atari generation has now grown up, and so have programming languages. But I think this nostalgia is responsible for us holding onto an out-dated language like a ratty security blanket.
Two articles that pointed this out was David Brin’s Salon.com post, “Why Johnny Can’t Code” and _why the lucky stiff’s article, “The Little Coder’s Predicament.” Both lamented the waning of a simple, approachable language and coding environment that was universally known. why responded with an interactive Ruby tutorial Hackety Hack. But David Brin’s solution was several steps backwards. A couple of decades backwards.
David Brin concludes his article (written in 2006) by buying his son a Commodore 64 (the kind of computer that programmers get nostalgic for) and beseeching Microsoft and other major companies to release a version of BASIC with their products. This leads me to say one thing:
Just let BASIC die.
I have those warm fuzzy memories of making simple text RPGs and hacking around with NIBBLES.BAS. I can tell you stories of how much fun I had making my own programs in BASIC. When I was a child, I typed like a child, I coded like a child, I Hello World’d like a child. But when I became a man, I put away that childish language. And with the modern languages we have now, there’s no reason for the next generation to take it up.
We were blissfully ignorant about the headaches and inconveniences that BASIC brought us. I’m not just talking about “GOTO Considered Harmful”. We forget about the warts of “End If” and “DATA and READ” and “int(rnd(1) * 10 + 2)” (and don’t forget to first put in “randomize timer”). But these are mistakes that have long since been corrected by other languages.
But we keep trying to revive this dead horse. There is Small Basic, Basic-256, (formerly KidBASIC), Run BASIC, et cetera et cetera. Each of these has almost no community compared to other mainstream languages. Each has their own custom APIs that they’ve kludged onto the original language (which means very shallow amounts of documentation.) And without popular adoption they are at risk of being dropped when their core developers find something new to work on.
The answer to why’s Little Coder Predicament is going to need several things. The language has to be easy to learn. But it also has to be powerful, and not restrained by the “4 kidz” style that many game creation kits have. It needs to be freely available. It needs to have language maturity, written by people who understand programming language design. It needs to be portable across several platforms so kids can share their programs with friends. It needs a REPL (i.e. the interactive shell.) It needs to have a large number of third party libraries developed for the language that can extend its capabilities. It needs large amounts of reference documentation and tutorials. You need to be able to go to Barnes and Nobles or the public library and find a real, dead-trees book that covers the language.
Python with Pygame provides much more powerful ways to do programming than BASIC but with the same gentle learning curve. Displaying sprites from image files, scaling them, and rotating them can be done in one line. Playing MIDI, WAV, and MP3 files is the same. You can easily incorporate the mouse (and, unlike Small Basic, use the scroll wheel). You can display text in any font you can load. Colors and transparency and drawing primitives are all dead simple. BASIC’s time has long since past, and it would be completely dead if not for the misguided attempts of now-grown programmers who misremember a past golden hey-day.
Another thing programmers love do to besides reminisce about the simpler days of BASIC and banana-throwing gorillas is write code. New code. Writing new code is easier than reading up on mature, already-adopted standards. Forging your own path has the excitement of crafting something original yourself, without all the hang ups of abiding and being restrained by past conventions (and, I would add, wisdom).
Nostalgia and wheel-reinvention are the two seductive forces I blame for this Weekend At Bernie’s-style jaunt we play with BASIC. I wanted to contribute to the next generation of coders, so I wrote “Invent Your Own Computer Games with Python” (available for free under a Creative Commons license at http://inventwithpython.com ). During the course of writing the book, I had to code up several games that the reader could copy. I found that writing these game programs in Python was far easier and in fewer lines than anything I had done in QBasic. I didn’t need to know about the advanced features of the language before I started (which is Java’s hangup) and I could be sure that the code I downloaded from others would run without modification (which is C++ and BASIC’s hangup.)
I’d rather produce a useful addendum rather than an original flop. BASIC leaves us standing on the shoulders of Shetland ponies. As rich as Python’s community is, there was a need for a simple, expansive tutorial that taught programming through the practical (and fun) means of creating video games. So I wrote Invent with Python. I loved coding games as a kid, and kids love doing it now. Playing games that you’ve created yourself is timeless. But BASIC is not. Just let BASIC die.