5. GUIs


Now the first job that any coder needs to do when writing a new piece of software is to figure out how to take the information that is being worked with (in a graphics program, an image; in a spreadsheet, a grid of numbers) and turn it into a linear string of bytes. These strings of bytes are commonly called files or (somewhat more hiply) streams. They are to telegrams what modern humans are to Cro-Magnon man, which is to say the same thing under a different name. All that you see on your computer screen--your Tomb Raider, your digitized voice mail messages, faxes, and word processing documents written in thirty-seven different typefaces--is still, from the computer's point of view, just like telegrams, except much longer, and demanding of more arithmetic.

The quickest way to get a taste of this is to fire up your web browser, visit a site, and then select the View/Document Source menu item. You will get a bunch of computer code that looks something like this:

<HTML>

<HEAD>

<TITLE>Welcome to the Avon Books Homepage</TITLE>
</HEAD>

<MAP NAME="left0199">
     <AREA SHAPE="rect" COORDS="16,56,111,67" HREF="/bard/">
     <AREA SHAPE="rect" COORDS="14,77,111,89" HREF="/eos/">
     <AREA SHAPE="rect" COORDS="17,98,112,110" HREF="/twilight/">
     <AREA SHAPE="rect" COORDS="18,119,112,131" HREF="/avon_user/category.html?category_id=271">
     <AREA SHAPE="rect" COORDS="19,140,112,152" HREF="http://www.goners.com/">
     <AREA SHAPE="rect" COORDS="18,161,111,173" HREF="http://www.spikebooks.com/">
     <AREA SHAPE="rect" COORDS="2,181,112,195" HREF="/avon_user/category.html?category_id=277">
     <AREA SHAPE="rect" COORDS="9,203,112,216" HREF="/chathamisland/">
     <AREA SHAPE="rect" COORDS="7,223,112,236" HREF="/avon_user/search.html">
</MAP>

<BODY TEXT="#478CFF" LINK="#FFFFFF" VLINK="#000000" ALINK="#478CFF" BGCOLOR="#003399">
<TABLE BORDER="0" WIDTH="600" CELLPADDING="0" CELLSPACING="0">

<TR VALIGN=TOP>

     <TD ROWSPAN="3">
     <A HREF="/cgi-bin/imagemap/maps/left.gif.map"><IMG SRC="/avon/images/home/nav/left0199.gif" WIDTH="113" HEIGHT="280" BORDER="0" USEMAP="#left0199"></A></TD><TD ROWSPAN="3"><IMG SRC="/avon/images/home/homepagejan98/2ndleft.gif" WIDTH="144" HEIGHT="280" BORDER="0"></TD><TD><A HREF="/avon/about.html"><IMG SRC="/avon/images/home/homepagejan98/aboutavon.gif" ALT="About Avon Books" WIDTH="199" HEIGHT="44" BORDER="0"></A></TD><TD ROWSPAN="3"><A HREF="/avon/fiction/guides.html"><IMG SRC="/avon/images/home/feb98/right1.gif" ALT="Reading Groups" WIDTH="165" HEIGHT="121" BORDER="0"></A><BR><A HREF="/avon/feature/feb99/crook.html"><IMG SRC="/avon/images/home/feb99/crook_text.gif" ALT="The Crook Factory" WIDTH="165" HEIGHT="96" BORDER="0"></A><BR><A HREF="http://apps.hearstnewmedia.com/cgi-bin/gx.cgi/AppLogic+APPSSURVEYS
Questionnaire?domain_id=182&survey_id=541"><IMG SRC="/avon/images/home/feb99/env_text.gif" ALT="The Envelope Please" WIDTH="165" HEIGHT="63" BORDER="0"></A></TD>
</TR>

<TR VALIGN=TOP><TD><IMG SRC="/avon/images/home/feb98/main.gif" WIDTH="199" HEIGHT="182" BORDER="0"></TD></TR><TR VALIGN=TOP><TD><A HREF="/avon/feature/jan99/sitchin.html"><IMG SRC="/avon/images/home/jan99/sitchin_text.gif" WIDTH="199" HEIGHT="54" BORDER="0"></A></TD></TR><TR VALIGN=TOP><TD COLSPAN="4"><IMG SRC="/avon/images/home/jan99/avon_bottom_beau.gif" WIDTH="622" HEIGHT="179" BORDER="0" USEMAP="#bottom"></TD></TR><TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN="4"><FONT SIZE="2" FACE="ARIAL,COURIER"><PRE>


</PRE><A HREF="/avon/ordering.html">How to order</A> | <A HREF="/avon/faq.html#manu">How to submit a Manuscript</A> | <A HREF="mailto:avonweb@hearst.com">Contact us</A> | <A HREF="/avon/policy.html">Privacy Policy</A></FONT>

<P>
</FONT></TD>

</TR>

</TABLE>

</BODY>

</HTML>

This crud is called HTML (HyperText Markup Language) and it is basically a very simple programming language instructing your web browser how to draw a page on a screen. Anyone can learn HTML and many people do. The important thing is that no matter what splendid multimedia web pages they might represent, HTML files are just telegrams.

When Ronald Reagan was a radio announcer, he used to call baseball games by reading the terse descriptions that trickled in over the telegraph wire and were printed out on a paper tape. He would sit there, all by himself in a padded room with a microphone, and the paper tape would eke out of the machine and crawl over the palm of his hand printed with cryptic abbreviations. If the count went to three and two, Reagan would describe the scene as he saw it in his mind's eye: "The brawny left-hander steps out of the batter's box to wipe the sweat from his brow. The umpire steps forward to sweep the dirt from home plate." and so on. When the cryptogram on the paper tape announced a base hit, he would whack the edge of the table with a pencil, creating a little sound effect, and describe the arc of the ball as if he could actually see it. His listeners, many of whom presumably thought that Reagan was actually at the ballpark watching the game, would reconstruct the scene in their minds according to his descriptions.

This is exactly how the World Wide Web works: the HTML files are the pithy description on the paper tape, and your Web browser is Ronald Reagan. The same is true of Graphical User Interfaces in general.

So an OS is a stack of metaphors and abstractions that stands between you and the telegrams, and embodying various tricks the programmer used to convert the information you're working with--be it images, e-mail messages, movies, or word processing documents--into the necklaces of bytes that are the only things computers know how to work with. When we used actual telegraph equipment (teletypes) or their higher-tech substitutes ("glass teletypes," or the MS-DOS command line) to work with our computers, we were very close to the bottom of that stack. When we use most modern operating systems, though, our interaction with the machine is heavily mediated. Everything we do is interpreted and translated time and again as it works its way down through all of the metaphors and abstractions.

The Macintosh OS was a revolution in both the good and bad senses of that word. Obviously it was true that command line interfaces were not for everyone, and that it would be a good thing to make computers more accessible to a less technical audience--if not for altruistic reasons, then because those sorts of people constituted an incomparably vaster market. It was clear the the Mac's engineers saw a whole new country stretching out before them; you could almost hear them muttering, "Wow! We don't have to be bound by files as linear streams of bytes anymore, vive la revolution, let's see how far we can take this!" No command line interface was available on the Macintosh; you talked to it with the mouse, or not at all. This was a statement of sorts, a credential of revolutionary purity. It seemed that the designers of the Mac intended to sweep Command Line Interfaces into the dustbin of history.

My own personal love affair with the Macintosh began in the spring of 1984 in a computer store in Cedar Rapids, Iowa, when a friend of mine--coincidentally, the son of the MGB owner--showed me a Macintosh running MacPaint, the revolutionary drawing program. It ended in July of 1995 when I tried to save a big important file on my Macintosh Powerbook and instead instead of doing so, it annihilated the data so thoroughly that two different disk crash utility programs were unable to find any trace that it had ever existed. During the intervening ten years, I had a passion for the MacOS that seemed righteous and reasonable at the time but in retrospect strikes me as being exactly the same sort of goofy infatuation that my friend's dad had with his car.

The introduction of the Mac triggered a sort of holy war in the computer world. Were GUIs a brilliant design innovation that made computers more human-centered and therefore accessible to the masses, leading us toward an unprecedented revolution in human society, or an insulting bit of audiovisual gimcrackery dreamed up by flaky Bay Area hacker types that stripped computers of their power and flexibility and turned the noble and serious work of computing into a childish video game?

This debate actually seems more interesting to me today than it did in the mid-1980s. But people more or less stopped debating it when Microsoft endorsed the idea of GUIs by coming out with the first Windows. At this point, command-line partisans were relegated to the status of silly old grouches, and a new conflict was touched off, between users of MacOS and users of Windows.

There was plenty to argue about. The first Macintoshes looked different from other PCs even when they were turned off: they consisted of one box containing both CPU (the part of the computer that does arithmetic on bits) and monitor screen. This was billed, at the time, as a philosophical statement of sorts: Apple wanted to make the personal computer into an appliance, like a toaster. But it also reflected the purely technical demands of running a graphical user interface. In a GUI machine, the chips that draw things on the screen have to be integrated with the computer's central processing unit, or CPU, to a far greater extent than is the case with command-line interfaces, which until recently didn't even know that they weren't just talking to teletypes.

This distinction was of a technical and abstract nature, but it became clearer when the machine crashed (it is commonly the case with technologies that you can get the best insight about how they work by watching them fail). When everything went to hell and the CPU began spewing out random bits, the result, on a CLI machine, was lines and lines of perfectly formed but random characters on the screen--known to cognoscenti as "going Cyrillic." But to the MacOS, the screen was not a teletype, but a place to put graphics; the image on the screen was a bitmap, a literal rendering of the contents of a particular portion of the computer's memory. When the computer crashed and wrote gibberish into the bitmap, the result was something that looked vaguely like static on a broken television set--a "snow crash."

And even after the introduction of Windows, the underlying differences endured; when a Windows machine got into trouble, the old command-line interface would fall down over the GUI like an asbestos fire curtain sealing off the proscenium of a burning opera. When a Macintosh got into trouble it presented you with a cartoon of a bomb, which was funny the first time you saw it.

And these were by no means superficial differences. The reversion of Windows to a CLI when it was in distress proved to Mac partisans that Windows was nothing more than a cheap facade, like a garish afghan flung over a rotted-out sofa. They were disturbed and annoyed by the sense that lurking underneath Windows' ostensibly user-friendly interface was--literally--a subtext.

For their part, Windows fans might have made the sour observation that all computers, even Macintoshes, were built on that same subtext, and that the refusal of Mac owners to admit that fact to themselves seemed to signal a willingness, almost an eagerness, to be duped.

Anyway, a Macintosh had to switch individual bits in the memory chips on the video card, and it had to do it very fast, and in arbitrarily complicated patterns. Nowadays this is cheap and easy, but in the technological regime that prevailed in the early 1980s, the only realistic way to do it was to build the motherboard (which contained the CPU) and the video system (which contained the memory that was mapped onto the screen) as a tightly integrated whole--hence the single, hermetically sealed case that made the Macintosh so distinctive.

When Windows came out, it was conspicuous for its ugliness, and its current successors, Windows 95 and Windows NT, are not things that people would pay money to look at either. Microsoft's complete disregard for aesthetics gave all of us Mac-lovers plenty of opportunities to look down our noses at them. That Windows looked an awful lot like a direct ripoff of MacOS gave us a burning sense of moral outrage to go with it. Among people who really knew and appreciated computers (hackers, in Steven Levy's non-pejorative sense of that word) and in a few other niches such as professional musicians, graphic artists and schoolteachers, the Macintosh, for a while, was simply the computer. It was seen as not only a superb piece of engineering, but an embodiment of certain ideals about the use of technology to benefit mankind, while Windows was seen as a pathetically clumsy imitation and a sinister world domination plot rolled into one. So very early, a pattern had been established that endures to this day: people dislike Microsoft, which is okay; but they dislike it for reasons that are poorly considered, and in the end, self-defeating.

In The Beginning Was The Command Line
Share on Twitter Share on Facebook Share on LinkedIn Share on Identi.ca Share on StumbleUpon

Get the Book:

Buy my 600-page Shell Scripting Book...


Or from other Amazon in other countries: USA, Germany, France, Spain, Italy, Canada, Japan, India, Brazil
Or from other retailers

Buy this Tutorial in Paperback or for Kindle:


USA, UK, Germany, France, Spain, Italy
Or Kindle in these countries: Canada, Australia, Japan, India, Brazil, Mexico

Buy this Tutorial as a DRM-Free PDF

(Free Sample)

$9.99 US Dollars

£4.99 UK Pounds

€6.99 Euros

You can join our Shell Scripting community on Facebook:

DefectiveByDesign.org