You are currently viewing Back to BASIC – the most consistent programming language in the history of computers

Back to BASIC – the most consistent programming language in the history of computers

For someone new to this strange craft, BASIC felt positively thaumaturgical. It was a spell: you said words that brought iron and silicon to life and made them do things. (As software engineer Erin Spiceland says, coding is “telling rocks what to think.”) If you were, as I was, steeped in Tolkien and other kitschy fantasy novels, there was a deep romance in the idea that everyday language could influence of reality. Speak, my 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 bundle of 1s and 0s. It was a back-and-forth affair: Write, compile, and then run it. With BASIC, by contrast, the machine responds immediately. You typed a few lines, hit RUN and boom – the machine interpreted it right then and there.

This transforms 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 type a few lines into the parser—then hit RUN to see how it worked. 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 coding process less prohibitive. It felt less like doing a Very Important Design and more like a simple one I’m messing around. Many of the world’s most popular languages ​​(such as JavaScript and Python) are now interpreted on the fly. But BASIC was among the first.

BASIC also created the world’s first mainstream open source culture. People shared code freely: If a friend wrote a great blackjack game, we’d all make a copy—by hand, like scribes in medieval monasteries—and run it ourselves. Every month, Compute magazine printed reams of BASIC mailed in by hobbyists. I spent an afternoon painstakingly typing in hundreds of lines from Conway’s The Game of Life that I had found in one 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 make the machine run. BASIC proved this at scale.

But as a practical language? To create shipping software?

BASIC wasn’t always great.

The graphics, for example, were glacial. I tried to do space shooting and it was incredibly slow. This is part of the reason so many BASIC game makers focus on text adventures instead: At least the words render quickly. The Cambrian explosion of text-based dungeon crawlers in the late 1970s and 1980s was partly a product of BASIC’s built-in limitations.

BASIC also had a few really thought-out elements. Infamously, it included the obscured GOTO command (read as “go to”). This allows you to write code that moves around: if the program gets to line 120, you can tell the computer to suddenly GO to line 25, for example.

For a newbie coder it was an easy way to write stuff! But it encouraged a complex “spaghetti” structure where logic was limited and zigzag throughout. If I write a long program—running into hundreds or thousands of lines—and use several dozen GOTO statements, my code will become a maze of mysteries impenetrable even to myself. Computer scientist Edsger Dijkstra hated this style so much that he wrote an entire essay condemning it: “Go to a statement deemed harmful.” Anyone who learned to program in BASIC would be, as he later wrote, “mentally crippled with no hope of regeneration.”

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

I’ll be looking for a Commodore PET emulator from time to time though. I’m going to type this ur-program that I first wrote over 40 years ago and hit RUN.

It still feels like magic.

Leave a Reply