Basic is back. (Philosophy - how it ought to be) Thomas Kurtz.
What is the truth about Basic? Does it merit mention in the same breath as Logo or Pascal? Is it even a language? Should it be taught in schools, or should it be exiled forever? Depends on whom you talk to. Since in this short article it is my turn, let me try to convince you that Basic, the language used by more people around the world than any other, is growing up and, like the prodigal son, returning home to its rightful place of honor.
John Kemeny and I, assisted by a small group of undergraduates, invented Basic more than 20 years ago. We have seen it grow and prosper as a teaching and applications language at our institution, where it is accorded great respect. But in the outside world, things are different; while Basic is the lingua franca among the hobbyists and kids, it is an object of scorn among the computer intelligentsia.
It is not hard to dissect this apparent schizophrenia--we are talking about completely different versions of the language. What we used 20 years ago lives on as Street Basic: no lower case, only GOTO and IF-THEN statements to augment the simple FOR-NEXT loop, GOSUB statements that referred to subroutines by line numbers and allowed no parameters. Small wonder that computer scientists gag at the thought, especially in view of the new understandings about structured programming. In fact, I even heard one well known computer scientist publicly declare, "I hate Basic!"
The disorderly world of Street Basic is a far cry from the more orderly world Dartmouth fashioned for itself over the same 20 years. We kept the language clean but still adapted to what we needed in programming languages. By 1971 we had callable external subprograms with parameters, which could be collected into libraries and separately compiled. By 1971 we also had interactive graphics, mainly throught the efforts of our colleague, Arthur Luehrmann.
By 1976, we had structured constructs, largely through the efforts of another colleague, Stephen J. Garland, who called this variant of Basic "SBasic," for Structured Basic. In 1979 we added true multicharacter variable names, internal and external subroutines and functions. The 1979 version even introduced what Professor Garland called "groups," a packaging structure (like the ADA "package") aimed at allowing true "data hiding" in Basic.
When we switched to SBasic in 1976 for several of our courses, we noticed that our students could handle programs about twice as long as they could before. We performed no statistically controlled experiments, but we could see with our own eyes that structured programming (using better loop and choice constructs while reducing or eliminating GOTOs) brought immediate improvement. We could even, and often did, write programs without line numbers; if there are no GOTO or similar statements, line numbers are not needed.
This present version of Basic is so rich and clean that Pascal, Fortran, and other famous languages, are just not widely used on our campus. Basic is quick and easy for small programs, and yet easily scales up for large applications. And it is used for the introductory computer science course. A New Standard
Except for one particular development, what I have just outlined would not be particularly relevant. (After all, software developments at isolated colleges and universities rarely have major effects outside their walls.) That development is the pending ANSI Standard for Basic, now in the final stages of approval and, we hope, acceptance. The features described above are almost exactly those found in the new (proposed) Standard, because we have made the effort to pattern our Basic on the Standard.
ANSI Basic contains (or more properly, will contain) a good collection of structured constructs, along with many other features one expects to find in a language standard: internal and external functions and subroutines, a large graphics module (optional), an elaborate file system including both display-format and internal-format files, fixed-decimal (optional, for those who want it), a matrix package, and line-numbered GOTOs and IF-THENs (coming in under the grandfather clause).
Perhaps the harshest criticism of the ANSI Standard is that it is too large, contains too many special capabilities, and looks like it was designed by a committee (which it was). We accept this criticism, but the state of affairs that caused it was inevitable. Basic boasts many constituencies around the world, each having a different idea as to what should be in the language. It is difficult, if not impossible, to produce the nice simple clean language that will satisfy each constituency.
That is the bad news. The good news is that there is enough in the language to allow folks to select what they want to use or teach. We use Basic in our introductory computer science course, ignoring GOTOs and other control statements that use line numbers. We stress modularization using both internal and external procedures (defined functions subroutines). We talk about parameter-passing mechanisms and scope of variables names. We use groups (which are not in the Standard) to allow variables to be shared among several subroutines but not with the entire program. Basic as a Bridge
At the other end of the pedagogical spectrum, if a third grade teacher wants to start out with simple programs using GOTO statements, that's okay. A month or a year later, that teacher can introduce the constructs of structured programming and tell the students that GOTO statements are no longer needed. Incidentally, we do not think that starting with GOTOs and then swithing to structured programming is a bad strategy, as claimed by some.
In fact, we have gathered some anecdotal evidence that many people find the complexities of a language like Pascal too much to face at their first exposure to computing; once introduced to computing through Basic, these people readily make the transition to Pascal, if that is the goal. (Basic was invented partly because we felt that the begin-end construct and the need for semicolons rendered Algol unpalatable to liberal arts students.)
The teacher can, as we often do, introduce the idea of modularization through internal subroutines without parameters. Once that notion is comfortable, parameters can be added. The subroutines can then be "detached" (made external). Several of them can be collected into libraries. And these subroutines can call themselves recursively.
Our conclusion is that the new Basic can readily fill the gap between Logo, in the lower grades, and Pascal, in the senior high schools and in the colleges. Basic also provides a nice alternative to Pascal for those who don't need data structures but who otherwise want to write large, well structured programs. We certainly hope that Basic will enjoy a comeback into respectability, but only if it is the New Basic.