Getting Down to BASICs
In one form or another, the BASIC programming Language has been around since before the dawn of personal computing. Easy to learn, simple to use, and useful for a wide variety of tasks, BASIC has opened the doors of computer programming for millions of people. Now, as a new generation of personal computers emerges, BASIC is continuing to evolve as a friendly and functional computer language--With a new look and feel.
Why BASIC? Why has this 22-year-old programming language--Beginner's All-purpose Symbolic Instruction Code--grown so immensely popular as an introduction to computer programming and as a general language? Despite its inherent limitations and numerous critics, BASIC remains the most widely taught and used language among computerists today.
The answers to these questions go back to a period before the advent of personal computing, in fact, years before a microcomputer was ever built. In the 1960s, the large mainframe computers ran programs by processing batches of punch cards--a system known as batch processing. These mainframes were machines that required a corps of trained operators to serve relatively untutored users. That average people would someday own and program powerful computers which fit on a desktop was unimaginable.
In those days, you didn't interact with a computer so much as present punch card offerings to it, and then wait for the computer to tell the computer operator to tell you the answer. More often than not, the first result was that a mistake somewhere in your batch of cards made an answer impossible until you corrected the error and then resubmitted the batch for another run. Not only was the process tedious, but it also meant waiting in line for access to the computer. A computer could serve only one user at a time.
Today, we tend to take for granted our ability to communicate quickly and easily with computers. The proliferation of personal computers has meant that individuals can have control over when and how often they work with a computer. And that kind of accessibility means that many people need a relatively easy way to communicate with computers without having to rely on other people as translators.
The original BASIC grew out of a project started back in 1964 by Dartmouth College mathematics professors Dr. John G. Kemeny and Dr. Thomas E. Kurtz. Kemeny and Kurtz were working with students on a timesharing project that would allow several people to gain simultaneous access to the university's mainframe computers. As a part of the project, Kemeny and Kurtz developed BASIC, from which all subsequent versions have evolved. The professors wanted BASIC to be an easy-to-use general-purpose programming language for their mainframe system that would allow more people to communicate with the computer on their own.
By the 1970s, when the first microcomputers were becoming available, BASIC had come to be regarded as an excellent language for personal programming and had already undergone several mutations. It became one of the first languages implemented on a personal computer when two college students--Paul Allen and Bill Gates--adapted it for the kit-built 4K RAM Altair in 1974. Allen and Gates later went on to found their own software company, Microsoft, Inc. Today, vasily improved descendants of the original Microsoft BASIC are available for almost all personal computers.
Developers of the original BASIC programming language, Dr. Thomas E. Kurtz (left) and Dr. John G. Kemeny, who now market a new version called True BASIC.
As BASIC became more widespread, it evolved in many different directions. Although the most popular version is Microsoft BASIC, none of the dozens of dialects adheres to a single standard. An involved program written in BASIC for one type of computer will rarely run on another type without at least some adjustments. Each version of BASIC embodies the strengths and weaknesses of the computer on which it runs, as well as the additions and deletions of those who adapted it from earlier versions. Some BASICs are so different from each other that they're almost like completely different languages.
Recently, this diversity led Kemeny and Kurtz to introduce what they call True BASIC (Addison-Wesley Publishing Company, Reading, Massachusetts) in late 1984. True BASIC is available for the IBM PC and compatibles, the Commodore Amiga, and the Apple Macintosh. In part, it's an attempt to deflect some of the criticism which has been aimed at BASIC over the years. Critics of BASIC often decry its lack of structure--it's not only possible, but quite easy, to write a BASIC program so disorganized that even the programmer cannot easily decipher it. On the other hand, BASIC's freedom from excessive structure-promoting rules is the very feature which attracts many programmers who prefer a more freeform style. Structured languages tend to encourage the production of more readable code, but also tend to impose more rules on the programmer. The debate over how rigidly structured a programming language should be is unlikely to end anytime soon.
True BASIC definitely leans toward the structured side. In fact, some of its new commands are almost identical to commands in Pascal, a popular structured language. Kemeny and Kurtz hope that True BASIC's structure, speed, errorhandling, mouse support, graphics, and easy transportability to other computers will establish it as a new standard.
As personal computers gained popularity, BASIC proved to be a fairly easy language to learn for most people. Since most versions of BASIC are interpreters, a programmer can enter a line of BASIC statements and test it immediately. Feedback is rapid because the computer intewrets and carries out the commands instantly. But that also means that the computer has to interpret every line of code while the program is running.
An alternative approach is a compiler. Popular compiled languages include Pascal, FORTRAN, C, COBOL, and some BASICs. Running a program with a compiler requires two steps. First, the compiler interprets all the commands in the program without carrying them out and creates a new version of the program on disk called object code, p-code, or run-time code. This file, incomprehensible to human eyes, is quite similar to a program written in machine language--it's a complex pattern of bits which is the only language that any computer really understands. After the compilation is completed, the object code can be run. Since all the commands in the program have already been interpreted by the compiler, the object code runs much faster than a program which must be interpreted one command at a time.
Unfortunately, the two-step process of compiling can take many minutes, which is frustrating for programmers--especially beginners. If the program contains an error, the whole process has to be repeated. It's not as frustrating as the old batch processing, but it's a step back in that direction.
Compiled languages also require more computer power than interpreted languages. They need faster processors and more memory--sometimes 512K of Random Access Memory (RAM) is scarcely enough for a compiler. This has largely prevented compilers from becoming popular on personal computers, since until recently most machines were limited to 64K of RAM. Because BASIC interpreters can be squeezed into as little as 8K of RAM, BASIC was the logical choice for the first generation of microcomputers.
In Amiga BASIC line numbers are unnecessary, and are replaced with labels that indicate subroutines and program divisions.
Most personal computer owners who are interested in programming quickly grow accustomed to the version of BASIC that comes with their machines. Some BASICs are built into the computer's Read Only Memory (ROM), while others are supplied on plug-in ROM cartridges or floppy disks. But there have been significant variations of BASIC even for the same brands of computers. Besides that, additional versions of BASIC are often made available by independent sources, as are packages which add enhancements to existing BASICs.
For example, Applesoft BASIC is a version of Microsoft BASIC that's used by Apple II-series computers. Integer BASIC, an earlier BASIC from Apple, was available in ROM on the original Apple II. Although faster than Applesoft BASIC, Integer BASIC doesn't allow floating-point math operations (the use of fractions) as does Applesoft. The Apple II + machine came with Applesoft BASIC in ROM, while the Apple IIe and IIc computers have Applesoft BASIC on built-in language cards. (The II+ can add a language card, too.)
Atari computers have had several different versions of BASIC available, as well as optional third-party BASIC languages. The Atari 400, 800, and 1200XL computers come with an 8K BASIC ROM cartridge, while the 600XL, 800XL, and 130XE computers have later revisions of BASIC built into ROM. There are also alternatives to Atari BASIC, such as Microsoft BASIC from Atari and BASIC XL and BASIC A+ from Optimized Systems Software (OSS) in San Jose, California.
Commodore 64 owners are familiar with the BASIC 2.0 version in their computers, the same version that appeared in the earlier VIC-20. Prior to 2.0, the earlier Commodore PET computer included a version 4.0. A variation between BASIC 2.0 and BASIC 4.0, called BASIC 3.5, was included in the Plus/4 and 16 computers. And the 128 includes a powerful version of BASIC, 7.0, that contains virtually all of the commands of the earlier BASICs.
But despite the differences among these forms of BASIC, they're all fairly similar in their organization. They're interpreted, giving immediate feedback to the user; they all use similar commands, variables, and functions; each line of BASIC begins with a line number; BASIC doesn't usually permit your computer to crash, so it's friendly to programmers; and access to printers and other peripherals is relatively easy to accomplish.
Within the past year, as the new Commodore Amiga and Atari ST computers have joined the Apple Macintosh--machines based on the more powerful 68000 microprocessor--computer users have been confronted with new BASIC languages that have several important differences from earlier versions. The Macintosh and the Amiga have BASIC languages that are almost identical, both created by Microsoft. The Amiga was initially released with a BASIC language called ABASIC, but that was superseded by the Microsoft version, called Amiga BASIC. The Atari ST, at this writing, has an ST BASIC from Atari, as well as several other versions of BASIC that should be available from third-party companies by the time you read this.
Both Amiga BASIC and Macintosh BASIC abandon the line numbers used in previous BASICs. Instead, meaningful labels are used that identify sections of code and subroutines. Although ST BASIC does have line numbers, you can put labels within lines and direct subroutines to those labels.
The programming environment changes as well. Windows-- with separate areas for your commands, the program listing, and the program output--take the place of the single screen you may be used to. With this system, you can actually see the program run while the program's code stays visible. Using a mouse, you can click on menu items like RUN and LIST instead of typing them in.
Macintosh BASIC, for example, offers several windows: a Command window to take your directions; two List windows, allowing you to have two different parts of the program onscreen at the same time; and an Output window which allows you to see the results of your programming. There are also programming tools that simplify your efforts. TRACE MODE, a debugging tool that can be switched on or off, highlights whatever line in your program is currently executing. The new BASICs also generally support the currently popular mouse environment, allowing you to create your own custom-designed windows, pull-down menus, and dialog boxes.
ST BASIC is fundamentally similar to the BASICs you may have used on your eight-bit computer, but offers accessibility to windows, drop-down menus, and graphic icons from the GEM Desktop environment much like Amiga BASIC and Macintosh BASIC. There are actually four windows on the ST BASIC screen: Output, List, Command, and, hidden behind the first three, an Edit window.
It would, of course, be precipitate to conclude that the new BASICs
represent the ultimate in man-machine communication. Rather, they seek
to offer a higher level of power, ease, and efficiency to the computer
programmer. Computer languages are continually evolving as the search
continues for ever more effective methods by which man can interact with
his increasingly intelligent inventions.
ST BASIC has line numbers, but the GEM operating environment includes multiple windows, drop-down menus, and icons much like AmigaBASIC and Macintosh BASIC.