In Defense of BASIC

02 May

If there’s a programming language that just don’t get no respect, it’s BASIC. One could make a pretty good little bathroom reader from all the snarky comments it’s attracted over the years. My favorite is this gem from Edsger W. Dijkstra: “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC. As potential programmers they are mutilated beyond hope of regeneration.” (I think Dijkstra’s slightly stilted phraseology works better if you imagine it being said with a heavy Dutch accent.) That’s a bit hyperbolic, to be sure, but certainly BASIC has a lot to answer for. When I was a kid trading software on my trusty Commodore 64, saying a program was written in BASIC was as good as saying that it sucked. And things haven’t changed that much today. Has any development environment, ever, produced as much awful software as Visual BASIC? I must admit that learning that a program was written in Visual BASIC is still sufficient reason to make me not even try it.

But despite all that, BASIC’s importance in the history of computing is immense. Before it, there existed two principal computing cultures. First there was the mainframe culture. Centered around IBM and a few other big companies that tried to compete with it, it was marked by what Steven Levy so memorably called the “priesthood” model of computing common to government and big business: a few highly trained, lab-coated elites serving as minions of The Machine, doing everything by (IBM’s) book, with creativity and fun strictly Off Limits. The other culture was the hacker culture that sprung up at MIT and similar technical universities and perhaps the occasional smaller company: a group of generally young savants who were fascinated by the world inside the machine and lived to hack, who scoffed at the conservatism and groupthink of IBM and particularly embraced the smaller machines of the more freewheeling Digital Equipment Corporation (DEC). Different as they were, neither of these cultures cared much about making computers accessible to the everyman. Neither culture had any time for or interest in anyone who did not think in bits and bytes and registers.

When John Kemeny and Thomas Kurtz designed and implemented the Beginner’s All-Purpose Symbolic Instruction Code at Dartmouth University in 1964, they were not trying to please hackers or computer scientists. They were, rather, trying to make it possible for “ordinary” individuals to productively use computers. Today the idea of a programming language for the masses is almost oxymoronic; they simply load up their computers with the latest from Microsoft, Apple, or whomever, and leave the programming to the professionals. Back in 1964, however, and for quite a long time afterward, applications software in the way we know it today did not really exist. Using a computer for any but the most rote of tasks virtually required programming it; certainly, at any rate, using a computer creatively did. In attempting to bring computing to the masses, Kemeny and Kurtz’s goals were not so much technical as sociological, political, even ideological. A third computing culture, one I already began to discuss when mentioning HP Time-Shared BASIC and Creative Computing magazine in the context of The Oregon Trail, began with BASIC at Dartmouth in 1964 and remained associated with the language for many years.

While the priests in their climate-controlled data centers and the hackers sequestered away in their cubbyholes at MIT were oblivious to the changes that were wrenching society in the late 1960s and early 1970s, the BASIC culture was full of counterculture excitement. They were all about bringing these machines out of the banks and the ivory towers and putting them at the disposal of the street. That makes their work as important as that of the hackers who were inventing C and Unix and laying the foundation of the Internet at about the same time. Sometimes, more perhaps than either would first want to admit, the two cultures even intersected, as they did in the case of the game I want to talk about in my next historical post, Hunt the Wumpus, which originated in HP Time-Shared BASIC but was novel and appealing enough to be attractive to the traditional hacker mindset as well — appealing enough to influence the first works of true IF.

As for BASIC, let’s remember to give it its historical due. If you’re excited by computers as artistic tools with relevance to the world and the people around them, you should recognize its place in forging those connections. The sniffing condescension of elitists like Dijkstra seems pretty unattractive indeed in this light.

So, yeah, respect is due. Now just don’t ask me to actually use the thing.


Tags: ,

26 Responses to In Defense of BASIC

  1. David Cornelson

    May 2, 2011 at 4:43 pm

    I am one of those BASIC programmers doomed by the first 16 years of my career in IT. I wrote BASIC on the original IBM PC, on PDP 11’s, On VAX’s, in QuickBASIC, MS Professional BASIC (a real compiler!), and Visual BASIC (I bought V1 from an 800 number at Microsoft – V1 was never shrink wrapped or available via retail).

    Writing BASIC on the PDP in early versions of RSTS, and original IBM PC was dodgy from a computer science perspective. I recall code that used the GOSUB command, but would return from varied end points. Talk about spaghetti code.

    Later, DEC upgraded BASIC to have real functions (encapsulation) and libraries, which made it possible to do some level of real programming.

    The VAX continued on that path and its version of BASIC was strongly typed and procedural. You could still fall back on dynamic variables, but it was frowned upon. (Oddly, dynamic typing is all the rage now).

    Visual BASIC of course was also highly procedural, but also object-based (not oriented). You could mimic some level of OO with VB, but in the end, it was procedural and still allowed dynamic typing (actually dynamic typing was required in many places).

    I believe TrueBASIC offered OO capabilities and I played with it a bit, but never for work.

    When .NET came out, object-oriented BASIC arrived, but I did not follow. I chose to learn C# and used Java books to pick up OO concepts. It’s taken me 10 years to unravel the procedural mindset I once had, but I do believe that for the most part, my brain is broken when it comes to understanding true OO. I understand OO, but it’s not always intuitive. I make leaps in understanding abstractions, but there’s still a procedural bent to my thinking. I still think in a linear fashion.

    But I loved BASIC. It allowed me, a non-engineer, to work in logic and computers on business systems. I would have never succeeded using C or C++. I would have gotten bored managing memory all the time and became a bartender or middle management.

    • Jimmy Maher

      May 3, 2011 at 5:23 am

      I think the last BASIC I worked with until very recently was True BASIC on my beloved old Amiga. When I started messing around with HP Time-Shared BASIC again recently, my main reaction was overwhelming frustration. But then I’ve been thinking like a C programmer for many, many years.

      Speaking of object-oriented programming: I think it’s very hard to break free of the procedural mindset, no matter what language(s) you gravitated to in the beginning. I’ve been working with C++ on and off for what must be close to 20 years now, but it wasn’t until I started using Java last year that I realized that I’d been essentially treating C++ as just an improved C with some nice syntax shortcuts, better string handling, easier memory management, etc. Java sort of subtly forces you to embrace the OOP mindset, and I think my experience with it it will change the way I program next time I go back to C++.

      But of course, its lack of object orientation was not what computer scientists hated so much about BASIC; C and, indeed, every other language of the time was also very procedure-oriented. (Not that you said anything different; just making sure this point is clear.)

      • David Cornelson

        May 3, 2011 at 5:35 am

        They hated GOTO and GOSUB, no doubt. And rightly so. I remember using the Tandy version of GW-BASIC and it allowed RETURN {line number}. The intent of RETURN was to go back to the next line after a GOSUB, but for some misbegotten reason, someone decided to allow RETURN to be a GOTO before eventually returning to that original GOSUB.

        Just thinking about those programs gives me a headache.

        My favorite BASIC was the Pro compiler MS sold in the late eighties. I still have a Payroll reporting system in production built on that compiler at a printing company in Milwaukee. The resulting programs were smoking fast because they actually made a real compiler and not the usual p-code interpreter. I still have the manuals and diskettes.

  2. Felix Pleșoianu

    May 2, 2011 at 5:26 pm

    I still remember when I got my first computer, a ZX Spectrum-compatible built from Russian components. I didn’t have any game tapes, or a BASIC book, but I did have some scraps of information gleaned from who-knows-where. It was enough to start banging on the keys.

    The first thing I got the machine to do was print a number. Less than an hour later I knew how to draw lines. And that was all I could do with it for days. But I had figured it out myself. There was my first computer, and I could talk to it, and it would carry on my orders!

    And that sums it up, really. The echoes of that first encounter are still with me. I like to make a game out of software development, and I like games that allow me to program them in one way or another. No modern computing environment, not even a Linux command line, offers the same combination of simplicity, immediacy and persistence. (MU*s do, but it’s not the same thing.)

    I know several people who started out that way, and they all understand computers far better than anyone who got a PC first. Most are (good) programmers; one is an engineer. They are patient, methodical and logical. And all because they had access to a very special learning tool at the right time…

    But gosh, BASIC was unreadable. I have no idea how we ever got anything done in it. Give me Forth any day. :P

    • Jimmy Maher

      May 3, 2011 at 5:33 am

      My parents bought my first computer for me for Christmas 1983. It was a Commodore 64, which was a pretty good choice for a kid at that time. Problem was, they knew nothing about computers, and so didn’t understand that just the bare computer by itself wasn’t too useful. I had no monitor, no disk drives, not even a tape drive for storage. Still, I hooked it up to the TV and spent many hours fiddling around with BASIC, even though shutting down the machine meant losing all of my work. Soon I scrounged up a disk drive and a monitor, and the pattern for much of the rest of my life was — for better or for worse — set.

      Linus Torvalds got his start in much the same way, fiddling around with a Commodore VIC-20. Not that I’m in a hurry to compare our relative achievements, of course. :)

  3. Victor Gijsbers

    May 2, 2011 at 6:08 pm

    I learned to program in GW-BASIC. Sure, it may have lacked many features you would expect an advanced programming language to have, and yes, it kind of suggested that using GOTO was a great idea, but still: most of what you did with BASIC was just solid programming. FOR-NEXT-loops, IF-THEN-ELSE-logic, cutting your program up into subroutines to be called by GOSUB, you’d do all the same stuff in C. It was a great way to learn programming, especially for a young person.

    (Talking about digital antiquities: my grandfather was one of the people in charge of the Mathematisch Centrum, which built the first computers for Philips starting in the late 40’s. In the 50’s, he was joined by a young man who would later become very well known as a computer scientist: Edsger Dijkstra. Unfortunately, my grandfather died before I was born, so I have never talked to him about these times.)

    • Nathan

      May 2, 2011 at 8:09 pm

      As a kid learning BASIC on the TI-99/4A circa 1983, I had a hard time seeing the usefulness of GOSUB. It could save a little typing once in a while, sure, but there was no provision for local variables and no clear way to program a recursive routine. I was really excited to find the DEF keyword in the manual that supposedly let you create “user-defined functions”, until I read through the instructions–it was just another way to save a little typing. It wasn’t until I discovered LOGO that I found what I was looking for.

      • Felix Pleșoianu

        May 3, 2011 at 5:52 am

        I like LOGO better myself, but BASIC is much closer to how the computer actually works. (If you ever played with assembly code, you know what I mean.) The educational value can’t be overstated; too many programmers nowadays, who got started with PHP for example, have no idea what’s actually going on inside the machine. And don’t even get me started about Java, which forces you to use objects even when it doesn’t make an ounce of sense.

    • Jimmy Maher

      May 3, 2011 at 5:39 am

      While a diligent and patient programmer could write relatively well-structured code in BASIC, the language didn’t demand it of you, and, indeed, seemed in some ways to actively discourage it. It’s possible to write awful code in C as well, of course — I’ve heard horror stories about programmers putting literally their entire program into a single main() function — but you have to kind of work at it a bit more.

      I also think there’s a combinatorial explosion problem of sorts that happens with BASIC. While simple learning programs are very straightforward and easy to read, programs of any real complexity, even if carefully crafted, become a nightmare to read, understand, and maintain. I know this only too well from poring over the Oregon Trail source. :)

  4. ZUrlocker

    May 2, 2011 at 8:35 pm

    I’ve quoted Djikstra myself on Basic, but you have to remember the context of his quote. It was 1975, before Apple was even founded. And I think his point was simply that if the language doesn’t encourage proper design concepts (modularity, structured code, etc) then it’s not a good training ground for writing large programs. Basic has always had a place as an easy to use language and it has evolved over the years to accomodate proper structured programming etc. But in making a language accessible, you also open it up to some less-than-professional efforts. Not a bad trade off.

    • Jason Dyer

      May 2, 2011 at 10:54 pm

      Considering even FORTRAN was spaghetti code at the time (FORTAN-77 wasn’t out yet) his quote does seem a bit unfair.

      • Jimmy Maher

        May 3, 2011 at 5:47 am

        Yes, there’s a note of elitism that I find quite distasteful. “How dare these Normals try to program on OUR machines!” This sort of thing is just about my least favorite side of nerd / hacker culture.

  5. Wade

    May 3, 2011 at 3:40 pm

    I think BASIC is pretty much beyond criticism. Criticism of programming languages is only relevant to the goals of a language, or inherent and insurmountable flaws in them (like… things that literally don’t work). The goal of BASIC, if any, was to let people program their computers to do whatever they wanted, and it did that brilliantly.

    Now that there are a zillion languages, the question of ‘What is this for?’ or ‘What does it do well?’ are more relevant when you give people a new one. For BASIC, the answers were ‘Whatever you want’ and ‘A bit of everything’ respectively.

  6. Harry Kaplan

    May 5, 2011 at 10:46 pm

    In 1970, after I graduated from college, I got a job at what today you might call a live walk-in help desk at the University of Pennsylvania Computer Center. Penn owned an IBM mainframe for general university use (actually, the Computer Science department had its own private UNIVAC machine for years, but that’s another story). Anyone writing in a general language was using either FORTRAN or PL/I, though lots of packages (SPSS or SAS, Simscript, etc.) were also in demand. A young student once came in and asked me how she could get her BASIC program to run. I politely explained that she couldn’t, as it wasn’t on the mainframe. “But,” she replied, looking truly puzzled, “I thought it was, well, basic!”


Leave a Reply to Tom Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.