BASIC

From Maze

(Difference between revisions)
Jump to: navigation, search
Line 132:Line 132:
Multiple statements on the same line were not possible with minicomputer BASICs and the ANSI standard; Kemeny and Kurtz saw the compression of statements as potentially confusing rather than helpful. When they released their much-revised True BASIC for home computers in 1983, they did not allow multi-statement lines. The colon is, however, important to 10 PRINT; this program could not be written as a concise one-liner without it.
Multiple statements on the same line were not possible with minicomputer BASICs and the ANSI standard; Kemeny and Kurtz saw the compression of statements as potentially confusing rather than helpful. When they released their much-revised True BASIC for home computers in 1983, they did not allow multi-statement lines. The colon is, however, important to 10 PRINT; this program could not be written as a concise one-liner without it.
−
Another prominent feature of 10 PRINT is also an artifact of the hardware underlying the language. Unlike its punch card-derived predecessors, BASIC didn't require programmers to put data in certain columns; yet there was a requirement that a number, such as "10", appear at the beginning of each line. While line numbers made branching possible by allowing GOTO and GOSUB, BASIC did not technically need line numbers for this purpose. Labels, such as those used in pre-existing languages like assembly, would have sufficed. The line number's real value is seen on a Teletype or other print terminal, or in any environment where full-screen, nonlinear 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, just retype a line with the same line number. To see what code is currently on a particular line, "LIST 50" will do the trick -- although if one had written the line recently, one could also look up or literally "scroll" back to where the line had been printed out.
+
Another prominent feature of 10 PRINT is also an artifact of the hardware underlying the language. Unlike its punch card-derived predecessors, BASIC didn't require programmers to put anything in certain columns; yet there was a requirement that a number such as "10" appear at the beginning of each line. While line numbers made branching possible by allowing GOTO and GOSUB, BASIC did not technically need line numbers for this purpose. Labels, such as those used in pre-existing languages like assembly, would have sufficed. The line number's real value is seen on a Teletype or other print terminal, or in any environment where full-screen, non-linear editing is not an option. Line numbers make 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, just re-type a line with the same line number. To see what code is currently on a particular line, "LIST 50" will do the trick -- although if one had written the line recently, one could also look up or literally "scroll" back to where the line had been printed out.
−
The practice of numbering program statements by multiples of five or ten is not merely rhythmic or 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 acknowledgment that a 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).
+
The practice of numbering program statements by multiples of five or ten is not merely rhythmic or 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 acknowledgment that a 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). While line numbers became an iconic feature of BASIC early in the personal computing era, they also contributed to a perception among programmers that the language is limited to simple tasks. Leaving space to add nine new lines of code between every original line may initially seem like plenty of flexibility, but it is rarely enough when programmers have a complex problem to solve. BASIC can still accommodate this situation by allowing the programmer to use GOTO and GOSUB in order to jump to as-of-yet unused numbers for a separate routine and then return to the original program flow when complete. Unfortunately, too many GOTO sub-routines can result in "spaghetti code" -- so named because the flow chart of a program becomes so confused and self-referential that all the lines look like a plate of spaghetti, making the program nearly unintelligible.
−
While line numbers became an iconic feature of BASIC early in the personal computing era, they also contributed to a perception among programmers that the language is limited to simple tasks. Leaving space to add nine new lines of code between every original line may initially seem like plenty of flexibility, but it is rarely enough when programmers have a complex problem to solve. BASIC can still accommodate this situation by allowing the programmer to use GOTO and GOSUB to jump to as of yet unused numbers for a separate routine and then return to the original program flow when complete. Unfortunately, too many GOTO sub-routines can result in "spaghetti code" -- so named because the flow chart of a program becomes so confused and self-referential that all the lines look like a plate of spaghetti, making the program nearly unintelligible.
+
In 1991 Microsoft realized that the perception of BASIC as limited to simple programs was holding the language back, and that this perception was largely due to a feature of the language that was no longer even necessary. Text editors that could display and allow access to screenfuls, or windowfuls, of lines had long been available, and line numbers were now doing more damage than good. As part of their 1991 QBasic the company dispensed with line numbers, replacing them with the assembly-like text labels that had once been dismissed as inconvenient.
−
In 1991 Microsoft realized that the perception of BASIC as limited to simple programs was holding the language back, and that this perception was largely due to a feature of the language that was no longer even necessary. Text editors that could display and allow access to screenfuls, or windowfuls, of lines had long been available, and line numbers were now doing more damage than good. As part of their 1991 QBasic the company deprecated line numbers, replacing them with the assembly-like text labels that had once been dismissed as inconvenient.
+
The simple fact that 10 PRINT includes both the colon and the line number -- features that have been added and removed from BASIC in response to hardware changes -- signals that 10 PRINT is from a particular time and related to a specific era of computing caught between competing input mechanisms. Its heritage and provenance are literally written right into its code.
−
 
−
The simple fact that 10 PRINT includes both the colon and the line number -- features that have been added and removed from BASIC in response to hardware changes -- signals that 10 PRINT is from a particular time and related to a specific era of computing caught between competing input mechanisms. Its heritage and provenance is literally written right into its code.
 
== Commodore BASIC==
== Commodore BASIC==

Revision as of 11:42, 16 July 2011

View this revision of BASIC.

Personal tools