Читать книгу Code Nation - Michael J. Halvorson - Страница 28
3.2The Tower of Babel Tower of Babel
ОглавлениеIn 1981, computer programming pioneer Sammet, Jean Jean Sammet observed that, by her count, there were already some thousand computer languages in the U.S.8 The proliferation of languages was not new, nor was it tied to the development of PCs. In fact, 20 years earlier there were already so many languages in use on mainframe computers that the journal Communications of the ACM published a “Tower of Babel” image on its January 1961 cover. (See Figure 3.3.) The image depicted the mythical tower-to-heaven structure described in the biblical book of Genesis, glossed with the names of dozens of computer languages on the mythical tower’s rings. The artwork recalls earlier critiques of “progress” in America’s social and political history, and it may also poke fun at the hubris of software industry officials for propagating so many compilers. (Human hubris is a pressing concern of the Genesis narrative.)
In fact, the task of learning to program has sometimes been explained as a simple process of picking a computer language and learning all its features, as if mastering a language’s grammar is the same thing as learning to think logically, or to understand how a computer processes information. As we observed earlier, however, software development involves much more than simply learning the syntax of instructions, as important as that may be. Jean Sammet captured the importance of Language syntax language syntax when she commented: “In the last analysis [language choice] almost always boils down to a question of personal style or taste.”9 In other words, the syntax of languages is interesting, but much in the differences between systems is simply a matter of fashion or technical culture.
Figure 3.3Communications of the ACM “Tower of Babel” Cover Image (January 1961), depicting the multiplication of computer programming languages (Courtesy of the ACM) Association for Computing Machinery (ACM)
So where did all the languages come from and why do programmers propagate them?
As I noted earlier, the first electronic computers did not utilize software or what we now call “programming” at all. They were hardwired devices that performed individual tasks, such as calculating the trajectory of a rocket. If you wanted to change the problem being computed, you didn’t modify the software, you changed the wiring to accommodate the problem. By hand.
An example of this type of device is the so-called Atanasoff–Berry Computer Atanasoff–Berry Computer, conceived in 1937 to solve linear equations, one problem at a time. The computer was assembled over a 5-year period at Iowa State College. When it was finished, the machine could be set up to solve two linear equations with up to 29 variables. This was impressive work and the results were highly valued by the Iowa State Physics Department. But in this context the device was essentially a single-purpose computer that specialized in linear equations.
One of the first programmable computers was the ENIACENIAC computer, designed by John Mauchly and J. Presper Eckert at the University of Pennsylvania. Dedicated in 1946, the ENIAC utilized sophisticated wiring, 18,000 vacuum tubes, panels of switches, and punched-card equipment for input and output.
The physical task of programming the ENIAC was considered less important than the abstract task of devising complex numerical calculations that the machine could solve. Accordingly, the job of “setting up” the computer with punched cards, cables, and switches was left to skilled female workers who had been trained in mathematics. (Note: The ENIAC team used different terminology than later computer designers, so the terms “programming” and “programs” in this section are somewhat anachronistic.)10
Regardless of gender considerations, it was not easy to create actual programs for the ENIAC system. In addition to conceptual errors and coding mistakes that arose as part of the planning process, the early log books indicate that there were regular shut downs due to faulty tubes, short circuits, carry errors, divider faults, water leaks, and other problems.11 In short, programming involved a host of physical issues in the early days that modern software developers have no knowledge of or responsibility for today.
In the 1950s, most early programs were written in numerical machine code, which consisted of 1s and 0s representing instructions for a specific computer. Programmers needed to learn the instruction set for a given computer, and then express the instructions in binary (base-2), octal (base-8), or hexadecimal (base-16) number systems depending on the machine’s internal architecture. Octal was especially common in early computer systems like the DEC PDP-8, ICL 1900, and the IBM mainframes, which structured internal memory using 12-bit, 24-bit, and 36-bit words.
Hopper, Grace MurrayGrace Murray Hopper described the intricacies of designing programs in this era in a keynote address at the first ACM conference on the history of programming languages, held in 1980 to document the achievements of the early days. (Hopper is shown with a Univac I computer system in Figure 3.4.) At the conference, Hopper explained that she wrote machine code programs in octal, where she routinely added, subtracted, multiplied, and divided in base-8 arithmetic. Hopper performed routine mathematical calculations in her head as she completed her work, although it was also common for engineers to use lookup tables to save time. (Ironically, Hopper later found it difficult to balance her own checkbook using base-10 arithmetic, as she was so steeped in using octal.)12 Later, Hopper and her peers used assembly language when newer computers arrived as way to write computer instructions in a more readable (textual) format.
Figure 3.4The operator’s console of a Univac I computer with four computer programmers (1957). From left to right, Donald Cropper, K. C. Krishnan, Grace Murray Hopper, and Norman Rothberg. (Courtesy of the Computer History Museum)
In assembly language, Program instructions program instructions are composed using short names or abbreviations (mnemonics) for Machine language machine language instruction codes. For example, the instruction “ADD” instructs the central processing unit to add the contents of one register to another. Symbolic names are also used to reference memory locations in assembly language program code.
Most Assembly language computer science students learn assembly language as part of their introduction to machine architecture, even if they don’t go on to program exclusively in this language. In my college years (the early 1980s), I started with the MACRO assembly language for the popular DEC VAX line of minicomputers.13 Later at Microsoft, I used Microsoft Macro Assembler (MASM) MASM.Microsoft Macro Assembler (MASM) Microsoft Macro Assembler (MASM) for programming IBM PCs and compatibles running MS-DOS. Coding skills of this type were standard fare in 1980s’ programming culture as both hobbyists and professionals needed to squeeze as much power and efficiency from the early systems as possible. (For more about MS-DOS programming requirements and the architecture of IBM PCs and compatibles, see Chapter 6 and Chapter 9.)
Assembly language is a nice improvement over machine language, but it is still closely connected to the hardware architecture of a computer system. Assembler is a low-level programming language designed for speed. This means that assembly language programs written for one computer will only work on computers of the same model or type. Translating an assembly language program from one computer model to another invites a lot of work, and this made it difficult to devise general-purpose programming solutions that could be deployed on multiple systems. However, as we learned with the Altair programming example, assembly language is valuable when you want to master a chip’s instruction set and create compact and efficient code. This is probably why computer scientist Knuth, Donald Donald Knuth (1938– ) wrote so many of his algorithms in machine (or assembly) language in his magisterial book series, The Art of Computer Programming. As a rallying cry for efficient code, Knuth advised:
High-level languagesHigh-level languages are inadequate for discussing important low-level details such as coroutine linkage, random number generation, multi-precision arithmetic, and many problems involving the efficient usage of memory. A person who is more than casually interested in computers should be well schooled in machine language, since it is a fundamental part of a computer.14
Donald Knuth wrote this in the foreword to his popular book series in 1962, and it was reprinted in many editions. His writings and advice are highly valued by academics and self-taught programmers alike.
But were there even earlier attempts to teach programming to new computer users?
Arguably the world’s first computer book containing specific instructions about how to program a computer was published in the U.K. in 1951. This impressive volume was entitled Preparation of Programs for an Electronic Digital Computer, and it was concerned with formulating machine code for the revolutionary EDSAC.Electronic delay storage automatic calculator (EDSAC) Electronic delay storage automatic calculator (EDSAC) electronic delay storage automatic calculator (EDSAC) computer at the University of Cambridge.15 (See Figure 3.5.) The authors were Wilkes, Maurice Maurice Wilkes, David Wheeler, and Stanley Gill, pioneering professors and technical writers connected with the Cambridge community. Their book offered a selection of common subroutines for handling basic operations in a computational program. The instructions were specific to the EDSAC, one of the world’s first stored-program computers.
The authors undertook daunting challenges, because no programming book had been written before and there was little in the way of notation or written conventions to express complex step-by-step instructions in book form. In fact, the routines are not “code” at all but instructions on how to set up the machine’s registers and the parameters needed to solve certain types of equations. But by distributing a selection of common “routines,” the authors explained to fellow scientists how the EDSAC worked, and readers with access to a similar computer could use the book to save time and expand their programming skillset. From this began a venerable tradition that continues in all good programming primers up to the present—readers learn by example.
Preparation of Programs did well enough such that a second edition was prepared in 1957. In the revised edition, the authors provided routines that were adaptable to a wider range of stored-program computers. In a literary sense, the Learn-to-program movement “learn-to-program” movement began with these books, although the intended audience was a narrow band of scientists and engineers and not the general public.