Back to BASIC—the Most Consequential Programming Language in the History of Computing

Share

For someone just getting into this weird craft, BASIC felt positively thaumaturgic. It was spellcasting: You uttered words that brought iron and silicon to life, and made them do things. (As the software engineer Erin Spiceland puts it, coding is “telling rocks what to think.”) If you were, as I was, marinated in Tolkien and other florid high-fantasy novels, there was a deep romance in the idea that everyday language could affect reality. Speak, friend, and enter.

BASIC also encouraged tinkering. Unusually for the time, it was an “interpreted” language. With many previous languages, you wrote the code, but before you could run it you had to “compile” it into a little package of 1s and 0s. This was a halting affair: Write, compile, then run it. With BASIC, in contrast, the machine responded instantly. You wrote a few lines, hit RUN, and boom—the machine interpreted it, right then and there.

This transformed coding into a conversation with the machine. Programming was like thinking out loud. I’d be working on a chatbot, for example, so I’d enter a few lines into the parser—then hit RUN to see how it performed. I’d add a few more lines, observe what worked and what didn’t, then run again. This back-and-forth dance with the machine made the whole process of coding less forbidding. It felt less like doing Very Important Design and more like just messing around. Many of the world’s most popular languages (like JavaScript and Python) are now also interpreted on the fly. But BASIC was among the first.

BASIC also created the world’s first mass open-source culture. People shared code freely: If a friend wrote a cool blackjack game, we’d all make a copy—by hand, like scribes in medieval monasteries—and run it ourselves. Each month, Compute magazine printed reams of BASIC mailed in by hobbyists. I spent one afternoon painstakingly typing hundreds of lines of Conway’s “Game of Life” that I’d found in an issue, then watched, mesmerized, as an artificial organism bloomed onscreen.

There’s a saying in the world of programmers that code is written primarily for other coders to read, and only secondarily for the machine to run. BASIC proved this at scale.

But as a practical language? For making shippable software?

BASIC wasn’t always great.

Graphics, for example, ran glacially. I tried to craft a space-shooter, and it was unplayably sluggish. This is part of why so many BASIC game makers focused instead on text adventures: Words, at least, rendered speedily. The Cambrian explosion of text-based dungeon crawlers in the late ’70s and ’80s was in part a product of BASIC’s built-in limitations.

BASIC also had a few truly ill-considered elements. Infamously, it included the benighted command GOTO (read as “go to”). This let you write code that hopscotched around: If the program got to line 120, you could tell the computer to suddenly GOTO line 25, for example.

For a newbie coder, this was an easy way to write things! But it encouraged complex “spaghetti” structure, where the logic bounded and zigzagged all over the place. If I wrote a longish program—going into the hundreds or thousands of lines—and used several dozen GOTO statements, my code would become a maze of mysteries, impenetrable even to myself. The computer scientist Edsger Dijkstra so loathed this style that he wrote an entire essay inveighing against it: “Go To Statement Considered Harmful.” Anyone who learned to program on BASIC would be, as he later wrote, “mentally mutilated beyond hope of regeneration.”

Dijkstra was being hyperbolic. But he wasn’t entirely wrong: After its heyday, BASIC plummeted in popularity. Newer languages emerged that encouraged cleaner, more modern styles of writing and ran more speedily. BASIC still lives on these days—itself modernized, with GOTO (mostly) banished—in the world of Microsoft Visual Basic, which many non-coder officefolk have used to kludge together apps for internal use. But these days, only 4 percent of professional developers will admit to using BASIC. Me, when I started programming again in the 2010s—after a 25-year gap—I turned instead to newer languages like Python and JavaScript.

Every once in a while, though, I’ll hunt down an emulator for the Commodore PET. I’ll type in that ur-program I first wrote, more than 40 years ago, and hit RUN.

Still feels like magic.