BASIC
From Maze
(Difference between revisions)
(→A Brief History of Programming) | (→Dartmouth BASIC and Time-Sharing Minicomputers) | ||
| Line 23: | Line 23: | ||
== Dartmouth BASIC and Time-Sharing Minicomputers == | == Dartmouth BASIC and Time-Sharing Minicomputers == | ||
| − | In 1962, change was sweeping through the remote Dartmouth campus. Time Magazine noted late that year, in article that declared the college was coming "out of the woods," that the school had built a major new arts center and that John Kemeny, who had made full professor at age 27, had built "the best college math department in the country." [http://www.time.com/time/magazine/article/0,9171,829487-1,00.html] The year, Kemeny and his colleague Thomas Kurtz had started developing a time-sharing system and a new programming language for the education of all students at Dartmouth -- not just those studying math, science, or engineering. | + | In 1962, change was sweeping through the remote Dartmouth campus. Time Magazine noted late that year, in article that declared the college was coming "out of the woods," that the school had built a major new arts center and that John Kemeny, who had made full professor at age 27, had built "the best college math department in the country." [http://www.time.com/time/magazine/article/0,9171,829487-1,00.html] The year, Kemeny and his colleague Thomas Kurtz had started developing a time-sharing system and a new programming language for the education of all students at Dartmouth -- not just those studying math, science, or engineering. "While the availability of FORTRAN extended computer from a handful of experts to thousands of scientific users," Kemeny wrote, "we at Dartmouth envisaged the possibility of millions of people writing their own computer programs." (Man and the Computer p.30) |
| − | The creators of BASIC sought to significantly lower the barriers to programming. To begin with, an interactive time-sharing system allowed users to quickly correct minor errors rather than coming back 24 hours later with a new stack of punched cards for their next scheduled batch job. BASIC was meant to help new programmers as well, with "error messages that were clear and friendly" and default options that would satisfy most users' needs (9). "If the expert needs something fancier," Kemeny and Kurtz declared, "let the expert do the extra work!" (11). Furthermore, BASIC was meant to be a true high-level language, so that programmers would not need any detailed knowledge of the specific hardware being used (9). | + | Kemeny and Kurtz sought to significantly lower the barriers to programming. They considered developing a subset of FORTRAN or Algol, but found this unsuitable and set to work, with a team of undergraduates, developing a new language (Masterminds of Programming p. 79). They saw the value of an interactive time-sharing system for allowing users to quickly correct minor errors rather than coming back 24 hours later with a new stack of punched cards for their next scheduled batch job. They also relaxed some of the specific requirements that were tied to using keypunch machines and cards. Kurtz told an interviewer, "we wanted ... to get away from the requirements that punched cards imposed on users, which was that things had to be on certain columns on the card." (Masterminds of Programming p. 81) Oddly enough, spaces between BASIC tokens were optional, and extra spaces were ignored, because, as Kurtz put it, "some people, especially faculty members, couldn't type very well." (MoP p. 81) This aspect of Dartmouth BASIC was carried over onto the Commodore 64. |
| − | Version 1 of Dartmouth BASIC introduced another concept to programming that is readily apparent in 10 PRINT: the line number. Prior to BASIC, computing jobs were performed by batch processing. A program consisted of a stack of IBM cards, prepared on a keypunch and submitted to the computer. Multiple programs would be fed into the computer, which would then execute them one by one, printing out the results. When all of the programs had been run, another batch could be given to it. Any error in any keycard would result in an unexecutable program; debugging was a long and painful process. Line numbers solved the problem, or at least made it easier to pinpoint errors. An error in a program meant only the offending line had to be retyped, rather than an entire keycard repunched. [I don't see how replacing one line with another is any harder or easier than punching another card. It seems to me to be an identical process: one occurs on a Teletype, one occurs on a keypunch machine. A card is one line long. -nm] | + | BASIC was designed in other ways to help new programmers, with "error messages that were clear and friendly" and default options that would satisfy most users' needs (9). "If the expert needs something fancier," Kemeny and Kurtz declared, "let the expert do the extra work!" (11). And, BASIC was meant to be a true high-level language, so that programmers would not need any detailed knowledge of the specific hardware being used (9). |
| − | The concept of line numbers was so unconventional at the time [Not true -- Fortran has line numbers. This information is just providing a clear specification so that others can reimplement BASIC. -nm] that the original BASIC instruction manual from 1964 went into some detail concerning their use: line numbers must be "no more than five digits," "contain no spaces or non-digit numbers," and finally "start at the very beginning of the line" (17-18)--all restrictions that modern users might take for granted but at the time were hardly self-evident. [Fortran's came at the end of the line, columns 73-80. -nm] It's difficult to overstate the value of line numbers to BASIC. Line numbers were not simply after-thoughts to the language, they were constitutive of the language itself, part of its very ethos. For example, line numbers made it easy to delete existing lines; simply type the line number without any further instructions, and the line disappears. To correct a single existing line, rewrite the line with the same line number. [Line numbers seems to be important because of Teletypes/print terminals. If you have a screen editor, you don't need them. Witness QBasic and Visual Basic. -nm] | + | While BASIC didn't require that programmers put things in certain columns, there was a requirement that something be put at the beginning of each line: A line number, such as "10." This facilitated branching, of course; the GOTO and GOSUB statements refer to the line numbers where program flow should continue. But BASIC did not need line numbers for this purpose. Labels, such as those used in assembly, would have sufficed, and indeed they do suffice in later versions BASIC that do not use line numbers. The line number's real value is seen on a teletype or other print terminal, or in any environment where full-screen editing is not an option. Line numbers made it easy in those cases to delete existing lines; simply type the line number without any further instructions, and the line disappears. To correct a single existing line, it's possible to simply retype the line with the same line number. |
| − | The practice of numbering program statements by multiples of five or ten is not merely aesthetic; the insertion of new lines in a program requires that, as the 1964 manual puts it, "the original line numbers <ins>not</ins> be consecutive numbers" (22). Numbering a program 10, 20, 30, and so on ensured that between every existing program statement there was room for nine more. [Very good. We should quote other sources that suggest this practice. There are many. -nm] | + | The practice of numbering program statements by multiples of five or ten is not merely aesthetic; the insertion of new lines in a program requires that, as the 1964 manual puts it, "the original line numbers <ins>not</ins> be consecutive numbers" (22). Numbering a program 10, 20, 30, and so on ensured that between every existing program statement there was room for nine more. It was an acknowledgement that the program is dynamic rather than fixed and perfect. The ''Commodore 64 User's Guide'' also advises that "it is good programming practice to number lines in increments of 10--in case you need to insert some statements later on" (33). |
| − | This convention makes several of the variations of 10 PRINT found "in the wild" stand out. For example, the three-line version in the C64 User Manual skips line 30, an intriguing absence that has no bearing on the program's process but which nonetheless stands out when the program is LISTed. [We're at Dartmouth in 1964 here; I don't think this is the time to talk about the skipping of line 30 in 1982 in the C64 User's Guide. -nm] The irregularity of the line numbering in this instance is particularly striking because the very same C64 manual advises that "it is good programming practice to number lines in increments of 10--in case you need to insert some statements later on" (33). Likewise, the one-line variant of 10 PRINT found in an issue of ''Run'' from 1984 begins with the line number 8, a seemingly arbitrary line number that obviously defies the increment of ten "good programming practice." Is this irregularity actually arbitrary though? Taken in context of the entire program-- | + | Dartmouth's own time-sharing system, DTSS, and the versions of BASIC that ran on it served almost all of the students at that college - Kemeny stated in 1971 that 90% of seven classes of freshmen had received computer training. Access to Dartmouth's system extended to many other campuses, and it was not the only time-sharing system with BASIC. Before the microcomputer revolution, other college and university students were taking required courses in computing using BASIC - at NYU's business school, for instance. Even before the arrival of home computers with built-in BASIC, the language had extensive, if not pervasive, influence. |
| − | |||
| − | 8 PRINT CHR$(205.5 + RND(8)); : GOTO 8 | ||
| − | |||
| − | --one wonders if the odd (that is, even) line number is meant to create further mystification about the program's purpose. It's easy to imagine a novice to BASIC confusing the function of the 8's that bookmark the program with the third 8 embedded in the RND function. Understood this way, the line number 8 becomes precisely want the creators of BASIC hadn't intended: an aesthetic device, creating a visual internal symmetry within the program. [All useful points, but let's not mention them in the context of 1964 Dartmouth. -nm] | ||
| − | |||
| − | In 1985, the developers of BASIC argued that "until the appearance of modern screen editors, the line-numbering system we devised was the easiest editing system available" (12). [This is my point too ... -nm] It's worth nothing that the Commodore 64 sat at the cusp of line-numbering editing and visual screen editors. It ''was'' possible with the C64 to edit a line of BASIC without retyping the entire line. Using a combination of SHIFT, ARROW, and INST/DEL keys, it was easy enough with the Commodore to edit a few characters of a line. One can't help wonder whether this move toward visual line editing, though a boon to programming in general, was an anathema to the ethos of BASIC, a sign of proliferating complexity. | ||
== Altair BASIC, Micro-Soft, and Microcomputers == | == Altair BASIC, Micro-Soft, and Microcomputers == | ||
