The venerable BASIC programming language is 53 this week.
(If you reverse the decimal number 53, you get its hexadecimal equivalent 35 – and there aren’t many two digit numbers [*] with that property!)
Strictly speaking, BASIC already existed by the start of 1964, but it was on 01 May 1964 that Dartmouth College in New Hampshire, USA, made it available interactively via its timesharing terminals.
By “interactively”, we mean that you could sit down at a terminal, GOTO the BASIC environment and start programming as you went along, trying out commands one at a time, adding them into your program, running it, fixing bugs, running it again, tweaking it, saving it…
…and then coming back later on and picking up where you left off.
If you’re looking for quasi-religious moments in computer programming, this was a bit like rending the veil of the temple in twain.
Dartmouth BASIC, as it became known, was a huge step in breaking down the barrier between those who used computers and the white-coated clerics and acolytes who operated them behind glass screens and double-door airlocks.
The new language was called BASIC because it was meant to be easy to learn, easy to use, and effective.
Indeed, BASIC was even stretched out into a backronym to convey the message that this was computer programming for everyone, not just for a high priesthood: Beginners’ All-purpose Symbolic Instruction Code.
You no longer needed to learn an unforgivingly esoteric language like FORTRAN, or a verbosely Joyceian beast like COBOL, or a robotically blocky dialect of ALGOL.
You didn’t need to punch your program onto 80-column cards or paper tape and hand it in through a grille at the abbey gate, or to write it out by hand in pencil on coding sheets and put it in a pigeon hole where someone else would type it in for you.
You didn’t even have to come back later to find out whether your program had run properly, or run at all, or even compiled successfully in the first place.
This ritualistic batched mode of operation explains why early COBOL compilers would do crazily unsafe things like blindly ignoring catastrophic errors and ploughing on anyway – leaving you with a worrying cascade of build-time warnings like
INCOMPLETE STATEMENT, PERIOD ASSUMED, or
SYNTAX ERROR, STATEMENT OMITTED, or
THIS WON'T WORK, BUT WHY STOP NOW? The hub of the programming wheel turned so slowly that it was worth seeing what your code would do anyway, even after you knew it was glaringly incorrect. As the compiler said,
WHY STOP NOW?
Dartmouth BASIC let you program as you went along, and though early BASIC applications must be considered to be miles away from today’s so-called literate programming, they were much more readable than most other programming languages of the day.
For an applied mathematician, a statistician or any other scientist with data to make sense of, BASIC made it easy to get useful results without climbing a learning curve that was as steep as any cliff.
Here’s an example, adapted from a fiftieth-anniversary article about the Dartmouth BASIC phenomenon:
1000 PRINT "0.0 0.1 0.2 0.3 0.4" 1010 PRINT "-+---------+---------+---------+---------+-" 1020 FOR X = -2.25 TO 2.25 STEP 0.25 1030 LET Y = EXP(-(X*X/2)) / SQR(2*3.142) 1040 LET Y = INT(100*Y) 1050 PRINT " "; 1060 FOR Z = 1 TO Y 1070 PRINT " "; 1080 NEXT Z 1090 PRINT "*" 1100 NEXT X
Try to figure out what it does and how it works – the formula and the way we’d visualise it today are shown below.
In fact, you can see for yourself what it does by copying-and-pasting it into a suitable online BASIC emulator, such as the one we used at a website called Quite BASIC.
In case you are wondering, the first
LET Y statement does the main normal distribution calculation for the various values of
X, which peaks at just under 0.4 when X = 0.
LET therefore scales the
Y value up to a maximum of 40 (100 x 0.4), and 40 spaces just happen to fit nicely across the width of the output window in the Quite BASIC emulator.
(40 columns was the usual screen width of early home computers, with lower-case letters a luxury offered only by the more expensive models.)
FOR Z loop prints
Y spaces (the trailing semicolon tells the
* as a graphical dot.
This may seem tame, or even feeble, by today’s standards, but stop to think how unbelievable this sort of simplicity and flexibility must have seemed more than half a century ago.
The idea that you could print a graph in moments to visualise an equation was amazing; the fact that you could interactively tweak parameters like the range of
X on line
1020 or the scale of
1040 and then try running the program again right away was all but revolutionary.
Sadly, BASIC was a product of its age, and was quickly usurped and trampled by all the upstart languages that came later – by the Modulas, the Oberons, the Erlangs, Haskells, Pascals, Perls, Pythons, Bashes, Rusts, Swifts and Clojures; by the Valas, the Scalas and the Befunges; by B, C, C++, D, F#, J, m4, R, S, T and, last but not least, Z (which is a notation, if the truth be told, but it’s a nice one to end on).
By the year 2000, BASIC was dead and buried, cast away into the dustbin of the last millennium along with shag-pile carpets, shoulder pads, mullets and Imperial weights and measures.
…that’s not right!
BASIC isn’t dead – not by a long shot: it’s alive and well, as a look at any Office document with macros in it will show you.
Word and Excel macros are written to this day in VBA, short for Visual Basic for Applications.
Although VBA looks very grown up compared to the stripped down syntax of 1960s-style Dartmouth BASIC, there’s no mistaking that it’s BASIC at heart.
Sadly, what’s good for the goose is good for the gander, and cybercrooks still love BASIC, too.
The first-ever ransomware, back in 1989, was the AIDS Information Trojan, written in Microsoft’s GWBASIC dialect; fast forward nearly 30 years, and we’re still seeing VBA used as a distribution vector for ransomware and other malware attacks today.
Plus ça change, plus c’est la même chose.
[*] If you use Quite BASIC, this should do the trick, old-school style:
10 FOR X = 10 TO 99 20 LET H = INT(X/10) 30 LET L = X - H*10 40 LET N = L*16 + H 50 IF X <> N THEN 90 60 LET R = L*10 + H 70 PRINT X + " IN DEC IS " + R + " IN HEX" 80 LET T = T + 1 90 NEXT X 100 PRINT "FOUND " + T + " OF THEM"