Issue #59: BASIC

Programming The Liberal Arts

In 1863, it was discovered on the walls of the Villa Lemmi, near Florence, a previously unknown fresco by Sandro Botticelli covered in whitewash, called “Giovane introdotto tra le Arti Liberali” (“A Young Man Being Introduced to the Seven Liberal Arts.”) This work of art was then removed and sold to the Louvre, where it has been exposed since 1882. In it, the young Lorenzo Tornabuoni, son of the head of the Roman branch of the Medici bank during the Quattrocento, is depicted holding the hand of Grammar, who introduces him to the other six liberal arts: Rhetoric, Logic, Arithmetic, Geometry, Astronomy, and Music.

Dartmouth College is an “Ivy League” liberal arts private university in the United States. It is one of the original nine “colonial colleges” of the East Coast founded between the 17th and 18th centuries; a list that includes Harvard, Yale, Columbia, Princeton, and a few more. Famous alumni from Dartmouth include the poet Robert Frost, Goldman Sachs CEO Henry Paulson, the programming language BASIC, former US vice-president Nelson Rockefeller, television producer Shonda Rhimes, and OpenAI CTO Mira Murati.

As a “liberal arts” school, Dartmouth begat BASIC as a mechanism for students interested in humanities or social sciences to learn and understand computers. This is something explained by Thomas E. Kurtz himself in his HOPL I (1978) conference paper:

Dartmouth students are interested mainly in subjects outside the sciences–only about 25% major in science or engineering. While science students will learn computing naturally and well, the nonscience group produces most of the decision makers of business and government. We wondered, “How can sensible decisions about computing and its use be made by persons essentially ignorant of it?” This question begged the conclusion that nonscience students should be taught computing.

Interesting: BASIC is a language designed to make the impossible dialogue possible. In the transcript of the presentation by Mr. Kurtz at HOPL I, this point came back:

And we could clearly see at that time-Kemeny and myself (when I say “we” it’s always Kemeny and myself)–we could clearly see at that time that there would be a problem of the two societies: those who knew about computing, that is, the professionals–the black bag people; and the “other” people in the society: the managers, the politicans, the lawyers, and, if you want, leaders. What could we do about solving the problem, or at least mitigating the problems of these two societies?

The goal of simplicity yielded another memorable quote in the previous paper:

BASIC has become the most widely known computer language. Why? Simply because there are more people in the world than there are programmers.

The quest for a language to teach computer programming to non-technically inclined people is the Holy Grail of Computer Science. The same quest, in other moments in history, brought us Logo, Scratch, Smalltalk, Fabrik, Lego Mindstorms, and so many other tools.

Psalms

We have already mentioned in this magazine Jean Sammet‘s major opus “Programming Languages: History and Fundamentals.” On page 229 we can find a description of the BASIC programming language. Even more interesting, on page 230 there is a sample of BASIC source code, showing a program calculating the greatest common divisor of a series of numbers. Here it is in its full uppercase glory:

100 PRINT "A", "B", "C", "GCD"
110 READ A, B, C
120 LET X = A
130 LET Y = B
140 GOSUB 500
150 LET X = G
160 LET Y = C
170 GOSUB 500
180 PRINT A, B, C, G
190 GOTO 110
200
300 DATA 60,90,120
310 DATA 38456,64872,98765
320 DATA 32,384,72
330
500 LET Q = INT(X / Y)
510 LET R = X - Q * Y
520 IF R = 0 THEN 560
530 LET X = Y
540 LET Y = R
550 GOTO 500
560 LET G = Y
570 RETURN
580
999 END

The most interesting aspect of this source code snippet is that, 54 years after its publication, it still runs verbatim on the following compilers and interpreters: QB64, the VICE Commodore 64 emulator, PC-BASIC, the AppleSoft BASIC online emulator, Bywater BASIC, Vintage BASIC, FreeBASIC (remember to pass the -lang qb argument to the fbc compiler), the 8bitworkshop IDE, Chipmunk Basic, and SmallBASIC. (The latter should not be confused with “Small Basic“, with which, by the way, this code is not at all compatible.) As a matter of fact, this BASIC code is also compliant with the ECMA-55 standard, also known as “Minimal BASIC”, of January 1978.

(You can load and run the snippet above in the BBC Micro web emulator, just by clicking this link.)

The good news is that all of these systems provide the same output (phew!) But even more important is the fact that we can run this code in the Dartmouth Time Sharing System (DTSS) Emulator: create a new account, enter “123456” as your user ID, then type BASIC and hit the enter key. Create a new file, and enter the greatest common divisor program line by line. Type LIST to review your code, and then type RUN.

But not all BASIC implementations are equal; the snippet above does not work with either Steve Wozniak’s Integer BASIC (DATA and READ statements not supported) nor Dennis Allison‘s Tiny BASIC, famously published in Dr. Dobb’s Journal, January 1976, page 5 (which had a maximum line number of 255, and similarly, had no DATA or READ statements.)

Genesis

Legend has it that the first program written in the BASIC programming language was executed in the early hours of May 1st, 1964 (spoiler: it was a Friday) in the DTSS of Dartmouth College. The minds behind this language are the aforementioned Mr. Kurtz, and John G. Kemeny. The latter is a member of The Martians, the famous group of Hungarian scientists that migrated to the USA before World War II, including luminaires such as John von Neumann, Theodore von Kármán, and Paul Erdős.

John G. Kemeny had quite a résumé: arrived at the age of 13 in the USA not knowing a word of English, he finished first in his class in high school. He then worked on the Manhattan Project with Richard Feynman and John von Neumann, later finishing his PhD thesis in Mathematics under the supervision of Alonzo Church. Finally, he worked as an assistant for Einstein in Princeton, and by the age of 29 he was the director of the department of mathematics in Dartmouth.

Bragging rights guaranteed.

Yet, Dr. Kemeny was not only brilliant, but also a humble and progressive leader. As president, he took the unprecedented decision of opening the admission process at Dartmouth College for female students. You have read right, before Dr. Kemeny, the only women roaming the halls of the university were secretaries or cleaning personnel. He also got rid of symbols of white oppression such as the offensive university mascot, supporting the requests from members of aboriginal groups, and was a staunch supported of minority rights.

To support his idea of bringing computers to the masses, he designed BASIC as the simplest possible language for non-computer scientists to understand, one that would run reasonably fast on a computer of 1964. Let us hear Dr. Kurtz enumerate some of the goals of Dartmouth BASIC, as he explained them in chapter 5 of Federico Biancuzzi’s “Masterminds of Programming” (O’Reilly, 2009):

  • One line, one statement. No periods or semicolons at the end (a staple of “lesser” languages in the years to come.)
  • Line numbers are GOTO targets.
  • All arithmetic is floating point (JavaScript, anyone?)
  • A number is a number (is a number).
  • Reasonable defaults.

There were other interesting characteristics:

  • Full hardware abstraction; the language was designed to be cross-platform (something that PEEK and POKE irremediably took away.)
  • Whitespace not mandatory (take this, Python.) The language was purposely simple to literally to not even need spaces between keywords and tokens.
  • All in all, a language simple enough for a single-pass compiler.

Such characteristics enabled an unprecedented workflow: just type and run your code; there is no visible compilation step. Arguably, one of the first REPL systems, in 1964.

Brilliant design ideas, just like its author. And the language was a resounding success, to the point that even the first edition of UNIX had BASIC built-in. The fact that Dr. Kemeny is not more widely known is related to the fact that BASIC is the language everybody loves to hate in 2023.

Exodus

Let us be honest: these days, BASIC (all in uppercase) has faded away in popularity, and to a large degree, its most common and simple use cases, usually associated with the seven liberal arts, were replaced with spreadsheets or other ad hoc programming languages since the early 1980s.

We are all, to a large extent, in denial of BASIC. Developers snob at its lack of modern features. At the time of this writing, the cloc tool reports all BASIC code as “Visual Basic,” regardless of its actual dialect, while GitHub does not feature any trending repository using BASIC. A whole website dedicated to the history of programming languages does not even mention its existence (quite rude, to be honest), focusing on the (supposedly most prestigious) hallmarks of functional programming instead (seriously? Graph Reducation? Chomsky Hierarchy?) The bat command does not mention BASIC in its list of supported languages: type bat --list-languages if you do not believe me. GitLab does not provide syntax highlighting for BASIC code (OK, OK, it does for VBScript and VB.NET, I give you that).

And so on and so forth (pun not intended.)

This hatred is not new, and it arguably started with Edsger Dijkstra himself:

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

Yeah, Edsger, we know you did not like the GOTO statement; neither did William Wulf, by the way. Both papers were part of a compilation by Yourdon advocating in favor of structured programming, in which not less than five articles had the words “go to” in their titles, and only one of those had a positive spin on the subject.

What about language rankings? Nothing very encouraging, either. At the time of this writing, TIOBE shows Visual Basic .NET in 7th place, Classic Visual Basic in 22nd, and VBScript in 38th; neither of which has ever been selected “language of the year” so far, and probably never will. In the IEEE ranking, it is the 31st place. For PYPL, Visual Basic for Applications is in 18th, and Visual Basic in 21st position. And finally, in Redmonk, Visual Basic gets the 30th spot.

And what about the education market? Well, Seymour Papert’s 1980 book “Mindstorms” explicitly dismissed BASIC as a language suitable for teaching programming in pages 33 and 34, promoting Logo instead. Given Papert’s influence, it is not a surprise that most educators are not even considering using BASIC these days.

BASIC is everywhere around us, still today, and its influence is both tremendous and stupendous, whether we like it or not. In the pages of this magazine, we have talked about BASIC in various editions, like those about Licensing, the English Language, Gaming, Computer Museums, and, of course, in the edition dedicated to Microsoft.

Microsoft providebit, Microsoft abstullit.
Sit nomen Microsofti benedictus.

It is fitting that we mention Microsoft again, for it is impossible to understand the meteoric ascent of this company without considering its commitment to BASIC. As I have said two years ago:

The one tradition that remained constant throughout all of Microsoft’s history is their infatuation for the BASIC programming language, through its various declinations: the already mentioned Altair BASIC, Microsoft BASIC, GW-BASIC, MBASIC, MSX BASIC, Commodore BASIC, QuickBASIC, QBasic, the “classic” Visual Basic, VBA, VBScript, VB.NET, and finally Small Basic; the latter available either on your Surface laptop or, even more 21st century-like, on Azure and best viewed through the Microsoft Edge browser.

Of all people, BYTE Magazine chose Bill Gates to write an article in October 1989 celebrating the 25 years of the BASIC programming language. Bill must have written the article in between meetings with Alan Cooper, who was busy pitching Microsoft for a visual UI toolkit that would eventually become Visual Basic in 1991.

The hatred against Microsoft, starting with the letter to hobbyists in 1976, fueled by Dijkstra, Wulf, Papert, and so many others, naturally spread to the BASIC programming language. If you read carefully, the “Thirteen ways to loathe VB” penned by Verity Stob are directed more to Microsoft than to the language itself:

13. Bill is making even more money out of this. And I am powerless to stop him. In fact, I am helping him.

Of course, abominations such as On Error Resume Next did not help, either, nor did the lack of a suitable VBRUN300.DLL file to run your favorite game. Comes to mind another quote from this magazine:

French-spoken VBA looked like this, circa 1994:

Proc Auto_ouvrir()
    BarresMenus(xlFeuille).ElémentsMenus("Macro").Supprimer
    Feuilles("Présentation").Activer
    Application.Attendre Maintenant + HeureVal("00:00:02")
    MiseEnRoute
    Feuilles("Menu").Activer
Fin Proc

I think it sounds better in Québécois.

And after decades of BASIC dialects, Microsoft dealt the final blows to the language in two major acts.

First act: Bill Gates kills the yet-to-be-released MacBASIC in 1984, a tale of greed and hubris better told by both Mark Jones Lorenzo in his 2017 book “Endless Loop: The History of the BASIC Programming Language,” and by Andy Hertzfeld in “The Sad Story of MacBASIC”, available online and on page 254 of his 2004 book “Revolution in the Valley: The Insanely Great Story of How the Mac Was Made.” The rise of the IBM PC and the growing popularity of Turbo Pascal slowly but surely brought an end to BASIC as a major language for hobbyist computer owners. Pascal was also the language of choice for the original Macintosh Toolbox, so in a sense, the writing was on the wall from 1985 onwards.

Second act: VB.NET appears in the scenario around 2002. Its incompatibility with Visual Basic 6 was the final straw for a whole generation of programmers. Its roadmap is, at best, murky. What about VBScript? Even if it is officially dead, you can still install it on Windows 11, if you really have to. All things considered, it is safe to say that the age of BASIC is long gone now.

Requiescat in pace.

Apocryphon

Academia is still debating how to choose a tool suitable to teach programming to younger generations.

Almost 60 years after its debut, BASIC deserves a renewal of interest as a teaching language, if anything because Johnny still cannot code. Paraphrasing Kurtz, there are still more people in the world than there are programmers: out of 8 billion people, around 30 million are programmers. In other words, less than 0.4% of the human population.

In a TIME magazine article commemorating the fifty years of BASIC, Dr. Kurtz provided a straightforward explanation for the disdain and opposition that his language has faced through the years:

Today, Kurtz is blunt about criticism of the language he co-created as being insufficiently serious or a dangerous way to begin learning about computer programming. “It’s B.S.,” he says.

“I’ll go out on a limb and suggest the degrading of BASIC by the professionals was just a little bit of jealousy–after all, it took years for us to develop our skill; how is it that complete idiots can write programs with just a few hours of skill?”

BASIC may not have made sense to people like Edsger Dijkstra. That was O.K.—it wasn’t meant for them. It made plenty of sense to newbies who simply wanted to teach computers to do useful things from almost the moment they started to learn about programming. And in 1975, as Dijkstra was accusing it of mutilating minds, there were about to be far more of those people than ever before.

Small hobbyist computers like the Foenix F256K come bundled with a BASIC dialect off-the-box. Every child can code in BASIC. And there are plenty of BASIC compilers and interpreters available for free (as in beer and as in freedom) for virtually every operating system. Computers used to like us when we spoke to them in BASIC, remember?

A whole generation of software engineers, including this author, grew up in a world where flipping the switch of a computer would load a BASIC interpreter stored in ROM within milliseconds. This experience is still unparalleled, in a world of preemptive multiuser multitasking operating systems that can take minutes to display anything meaningful on the screen. Répétez avec moi: turn the computer on, start typing code, LIST and RUN. No compilation step, no hidden complexity, just a student and their code, mano a mano. Even today, in the age of Rust, Python, and countless npm packages, such an experience remains a golden standard. Heck, the “B” in BASIC stands for “Beginners” after all.

Microsoft knows this, too. First they released the source code of GW-BASIC on GitHub so that we can finally know which random number generator algorithm they used. Now it wants to teach us how to program the Altair 8800 on Azure Sphere.

And if everything else fails, we can attend the GOTO Conference. Take that, Edsger.

The young Lorenzo Tornabuoni would have found programming in BASIC fascinating. He could have created Music, studied Logic and Geometry, learned Astronomy, and practiced Rhetoric and Grammar. That’s what the “A” in BASIC stands for: “All-purpose.” In Botticelli’s painting, the lady representing Mathematics is timidly raising her hand, calling for the attention of the intimidated débutant; sitting above her, leading the group and more effusively greeting Lorenzo, is Prudentia. At the bottom left there is a small cherub watching the scene closely; I would like to think of it as Programming, the eighth liberal art instead, preparing itself to blossom in the centuries to come.

We used to teach kids how to think like a computer. These days, however, we are more interested in teaching computers how to think like kids, and we are doing a terrible job in both cases.

Cover image: Sandro Botticelli from the The Yorck Project (2002) “10.000 Meisterwerke der Malerei” (DVD-ROM), distributed by Directmedia Publishing GmbH. Image in the public domain.

Donate using Liberapay

Adrian Kosmaczewski is a published writer, a trainer, and a conference speaker, with more than 25 years of experience in the software industry. He holds a Master's degree in Information Technology from the University of Liverpool.