For someone new to this strange craft, BASIC is pure magic. It’s magic: you speak words that bring iron and silicon to life and make them do things. (As software engineer Erin Spiceland puts it, coding is “telling rocks what to think.”) If you were, like me, steeped in Tolkien and other fantasy novels, there was a deep romanticism in the idea that everyday language could affect reality. Speak, friend, and come in.
BASIC also encouraged tinkering. Unusually for its time, it was an “interpreted” language. In many previous languages, you had to write the code, but before you could run it, you had to “compile” it into a little bundle of 1s and 0s. It was a difficult task: write, compile, and then run. With BASIC, on the other hand, the machine responded instantly. You just wrote a few lines, hit RUN, and boom, the machine interpreted it, right there.
This turned coding into a conversation with the machine. Programming was like thinking out loud. I was working on a chatbot, for example, so I would type a few lines into the parser, then hit RUN to see how it worked. I would add a few more lines, see what worked and what didn’t, and then run again. This back-and-forth dance with the machine made the whole coding process less daunting. It felt less like Very Important Design and more like just coding. mess around. Most of the world’s most popular languages (like JavaScript and Python) are now also interpreted on the fly. But BASIC was one of the first.
BASIC also spawned the world’s first mass open-source culture. People freely shared their code: If a friend wrote a cool blackjack game, we would all make a copy—by hand, like medieval monastic scribes—and run it ourselves. Every month, Compute magazine printed reams of BASIC that hobbyists mailed in. I spent one afternoon painstakingly typing hundreds of lines of Conway’s “Game of Life” that I found in an issue, then watched, mesmerized, as an artificial organism hatched on the screen.
There is a saying in the programming world that code is written first to be read by other coders, and only second to be executed by the machine. BASIC proved this on a grand scale.
But as a A practical language? To create deliverable software?
BASIC wasn’t always great.
The graphics, for example, were glacial. I tried to make a space shooter, but it was unplayable. This is part of the reason so many BASIC game designers focused on text adventures: the words, at least, were fast to render. The Cambrian explosion of text-based dungeon crawlers in the late ’70s and ’80s was partly a result of BASIC’s built-in limitations.
BASIC also had some really poorly thought-out features. It included the GOTO (which stood for “go to”) command, a clumsy command that allowed you to write code that jumped from one line to the next: if the program got to line 120, you could tell the computer to suddenly jump to line 25, for example.
For a novice programmer, this was a simple way to write things! But it encouraged a complex “spaghetti” structure, where logic was bounded and zigzagged in all directions. If I wrote a long enough program—hundreds or thousands of lines—and used several dozen GOTO statements, my code would become a labyrinth of mysteries, impenetrable even to myself. Computer scientist Edsger Dijkstra hated this style so much that he wrote an entire essay criticizing it: “The Go To statement is considered harmful.” Anyone who learned to program in BASIC would be, as he later wrote, “mentally mutilated beyond all hope of regeneration.”
Dijkstra was exaggerating a bit. But he wasn’t entirely wrong: After its heyday, BASIC’s popularity plummeted. New languages emerged that favored cleaner, more modern writing styles and ran faster. BASIC still lives on—itself modernized, with GOTO (mostly) banned—in the world of Microsoft Visual Basic, which many non-coding office workers used to cobble together applications for internal use. But today, only 4% of professional developers admit to using BASIC. For my part, when I started programming again in the 2010s—after a 25-year hiatus—I turned to newer languages like Python and JavaScript.
Every now and then I go looking for an emulator for the Commodore PET. I type in the program I wrote over 40 years ago and press RUN.
It still feels like magic.
0 Comments