Skip to content

Back to BASIC: The Most Consistent Programming Language in Computer Science History

    To someone just starting out in the strange field, BASIC felt downright thaumaturgic. It was a spell: You spoke words that brought iron and silicon to life and made them do things. (As software engineer Erin Spiceland puts it, coding is “telling rocks what to think.”) If, like me, you were steeped in Tolkien and other flowery high-fantasy novels, there was a deep romance 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. With many earlier languages, you wrote the code, but before you could run it you had to “compile” it into a little packet of 1s and 0s. This was a hesitant affair: write, compile, run. With BASIC, by contrast, the machine responded immediately. You wrote a few lines, hit RUN, and boom – the machine interpreted it, instantly.

    This transformed coding into a conversation with the machine. Programming was like thinking out loud. For example, I was working on a chatbot, so I would feed a few lines into the parser and press RUN to see how it performed. I would add a few more lines, observe what worked and what didn’t, and then run it again. This back-and-forth dance with the machine made the whole process of coding less daunting. It felt less like Very Important Design and more like just to mess. Many of the world's most popular languages ​​(such as JavaScript and Python) are now also interpreted on the fly. But BASIC was one of the first.

    BASIC also created the world's first massive open-source culture. People shared code freely: If a friend wrote a cool blackjack game, we all made a copy, by hand, like scribes in medieval monasteries, and played it ourselves. Every month, Compute Magazine printed stacks of BASIC sent in by hobbyists. I spent an afternoon painstakingly typing out hundreds of lines of Conway's “Game of Life” that I'd found in an issue, then watched, mesmerized, as an artificial organism blossomed on the screen.

    There is a saying in the programming world that code is written primarily to be read by other programmers, and only secondarily to be executed by the machine. BASIC proved this on a grand scale.

    But if a practical language? For making shippable software?

    BASIC wasn't always great.

    Graphics, for example, were slow. I tried to make a space shooter, but it was unplayably slow. This is partly why so many BASIC game makers turned to text adventures instead: at least words rendered quickly. The Cambrian explosion of text-based dungeon crawlers in the late 1970s and 1980s was partly a product of BASIC's inherent limitations.

    BASIC also had some really poorly thought-out elements. It infamously contained the neglected GOTO (read: “go to”) command. This allowed you to write code that hopped around: if the program got to line 120, for example, you could tell the computer to suddenly GOTO to line 25.

    For a beginning programmer, this was an easy way to write things! But it encouraged a complex “spaghetti” structure, with logic zigzagging all over the place. If I were to write a fairly long program—hundreds or thousands of lines—and use dozens of GOTO statements, my code would become a maze of mysteries, impenetrable even to me. Computer scientist Edsger Dijkstra hated this style so much that he wrote an entire essay about it: “Go To Statement Considered Harmful.” Anyone who learned to program in BASIC would, as he later wrote, be “mentally crippled beyond all hope of regeneration.”

    Dijkstra was exaggerating. But he wasn’t entirely wrong: after its heyday, BASIC’s popularity declined. Newer languages ​​emerged that encouraged cleaner, more modern writing styles and ran faster. BASIC lives on, itself modernized and GOTO (mostly) banished, in the world of Microsoft Visual Basic, which many non-programmer office workers have used to build apps for internal use. But today, only 4 percent of professional developers admit to using BASIC. When I started programming again in the 2010s, after a 25-year hiatus, I turned instead to newer languages ​​like Python and JavaScript.

    But every now and then I go hunting for an emulator for the Commodore PET. I type in that ancestral program I first wrote, over 40 years ago, and hit RUN.

    It still feels like magic.