Tuesday, February 19, 2013

Software = Onion

Software is onionlike, a thing of layers, each built painstakingly and precariously on the previous one, each counting on the one below not to move or change too much.

Programmers call these accretions "layers of abstraction," because each time a new one is added, something complex and specific is being translated into something simpler and more general. 

At the very bottom of the pile, sitting right on top of the core memory, is assembly language, invented half a century ago to make it easier for programmers to manipulate the core's zeros and ones by hand. Instead of simply writing lots of binary code, like 10110000 01100001, they could write the equivalent assembly language instruction, which uses commands with names like "mov" and gives variables easier-to-remember labels. You're still pushing bits around by hand, but you have some easier handles to grab. 

For most human beings assembly language is difficult to learn and arduous to write. It's also not very adaptable; there's a different assembly language for each type of CPU, requiring you to rewrite your code each time you want to run it on a different make of computer.

So the programmers of yore started adding more layers of abstraction, with each layer moving a little further away from the machine and closer to the human being.  The decade from the mid1950s to the mid1960s saw a sort of Cambrian explosion of new programming languages, including many that are still in use or that became the ancestors of Lisp, Cobol, Algol, Basic. The very first to achieve wide use was Fortran—short for "FORmula TRANslating system." In Fortran, laborious sequences of assembly language procedures were summarized in brief commands. The human programmer would write a sequence of these commands—source code; then a kind of uberprogram running on the computer called a compiler would translate those commands into object code in the machine's own language. 

It was as if people who had communicated by spelling out every word to one another, letter by letter, suddenly figured out how to talk in syllables.

The leap was vast—so vast that at first Fortran's promoters believed they had not so much advanced computer programming as entirely tran scended it. Their invention, they wrote, would "virtually eliminate coding and debugging." :) They touted Fortran as an "automatic coding system," since it replaced the opaque binary code of machine language or the only slightly more accessible assembly language with a relatively more readable sequence of commands like READ, ASSIGN, GOTO, and STOP.

But like so many innovations in programming over the following decades, it could not deliver on its dream. Ultimately, Fortran, for all its originality and utility, solved one set of problems only to introduce others. Within a decade of its introduction, the entire field of programming was the victim of its own success, and experts gathered in international conclaves to ponder a way out of "the Software Crisis." 

-  Excerpt from Dreaming in code : two dozen programmers, three years, 4,732 bugs, and one quest for transcendent software by
Scott Rosenberg

No comments:

Post a Comment