To someone just discovering this strange technology, BASIC was like magic. Like casting a spell. You spoke words and steel or silicon came to life, doing things. (As software engineer Erin Spiceland puts it, coding is “telling a rock to think.”) For someone steeped, like me, in Tolkien and other brilliant high fantasy novels, there was a deep romance in the idea that everyday language could affect reality. Speak, my friend, and enter.
BASIC also encouraged tinkering. Unusually for its time, BASIC was an “interpreted” language. In many earlier languages, you wrote your code, but before you could run it, you had to “compile” it into a little package of 1s and 0s. It was a laborious process: write, compile, run. In contrast, with BASIC, the machine responded instantly. You wrote a few lines, hit RUN, and the machine interpreted it on the fly.
This turned coding into a conversation with a machine. Programming was like saying what you were thinking out loud. For example, when working on a chatbot, you type a few lines into the parser, hit run and see how it performed. Add a few more lines, observe what works and what doesn’t, run it again. This interaction with the machine made the whole coding process less daunting. It felt more like just playing around, rather than doing any really significant design. 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 spawned the world’s first large-scale open-source culture. People shared code freely. A friend wrote a cool blackjack game, and like medieval monastic scribes, we all copied it by hand and ran it ourselves. Every month, Compute magazine printed loads of BASIC that enthusiasts mailed in. I spent one afternoon painstakingly typing out hundreds of lines of code for Conway’s “Game of Life” that I’d found in an issue, then watched in fascination as artificial creatures blossomed on the screen.
There’s a saying in programmer’s world that code is written primarily to be read by other programmers and only secondarily for a machine to execute. BASIC proved this on a massive scale.
But as a practical language? As a language for creating shippable software?
BASIC wasn’t always great.
For example, the graphics were too slow; they tried to make a space shooter, but it was unplayably slow. This is one reason why many BASIC game makers focused on text adventures; at least the words rendered quickly. The explosion of text-based dungeon crawlers in the late 1970s and 1980s was partly due to the limitations built into BASIC.
BASIC also had some really naive elements, most notoriously including the mindless command GOTO (pronounced “go to”), which let you write code that jumped around all over the place – for example, if your program got to line 120, you could suddenly tell the computer to GOTO to line 25.
For novice programmers, this was an easy way to write code. But it encouraged complex “spaghetti” structures, with logic that zigzagged and scattered all over the place. If you wrote longer programs, hundreds or even thousands of lines long, with dozens of GOTO statements, your code would become a mysterious maze that you couldn’t understand. Computer scientist Edsger Dijkstra hated this style so much that he wrote an essay denouncing it, “The Potential Harmful Go To Statements.” As he later wrote, anyone who learned to program in BASIC would be “mentally damaged beyond hope of recovery.”
Dijkstra was exaggerating. But he wasn’t entirely wrong. After its heyday, BASIC’s popularity plummeted. New languages emerged that encouraged cleaner, more modern writing styles and ran faster. BASIC lives on today in the world of Microsoft Visual Basic, itself modernized and (mostly) free of GOTOs. It was used by many non-programmers to make improvised apps for their companies. 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 new languages like Python and JavaScript.
But every once in a while, I find myself digging out an emulator for the Commodore PET, typing in the original programs I first wrote over 40 years ago,[実行]Press[ENTER].
It still feels like magic.