Code Nation. Michael J. Halvorson
Чтение книги онлайн.
Читать онлайн книгу Code Nation - Michael J. Halvorson страница 25
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.
3.3High-level languagesHigh-level Languages
Beginning in the 1950s, Hopper, Grace Murray Grace Hopper and her peers began to develop a solution that would make software less costly to produce and programming easier to learn.16 This solution was known to contemporaries as an “automatic programming language” or “autocode” for short. We know it today as the first of many high-level languages—software abstractions with a syntax closer to human language—which hide some of the inner-workings of a computer. Using a high-level language, a programmer can write instructions using recognizable