Chapter Two

How to Talk to a Computer

 

 

BASIC

We will embark on this grand adventure using BASIC as our vehicle. BASIC is the most common computer language; versions of BASIC are available on just about every microcomputer. BASIC boasts two other advantages that make it ideal for our efforts.

First, it is an interactive language; when you attempt something in BASIC, you see the results of your attempt almost immediately. Many other computer languages require you to endure time-consuming intermediate steps before you can see the results of your work. BASIC's interactivity has great importance to a beginning programmer. The fast feedback it offers makes it much easier to see one's mistakes. Indeed, this fast feedback encourages lots of experimenting with the language. The trial-and-error approach that BASIC encourages is an excellent way to learn. Of course, professional programmers are not supposed to use trial-and-error programming techniques, so computer scientists disdain BASIC as a naughty language. Since we're not here to become professional programmers, we'll just thumb our noses at those computer scientists.

The second advantage of BASIC is its simplicity. Other computer languages require you to learn all sorts of theory, structure, and special commands before you can write your first program. It can take days or weeks of study before one is knowledgeable enough to write the simplest program with the language. Not so BASIC. This language is so simple that you can start using it in a matter of minutes. As you learn more, your programs can become better. It's that simple. And that is exactly how you're going to learn programming. Let us begin.

Fire up your computer and get it started in BASIC. You'll have to go to the computer store and buy a BASIC language program. Most computers will require you to load BASIC into the computer from your disk drive. I can't tell you how to set up your computer with BASIC because it varies with each computer. Follow the instruction manual that comes with the BASIC language; when the screen says "READY", you're all set to go.

KEYBOARD ETIQUETTE

Before you can easily converse with the computer, you will need to learn a few simple rules of etiquette that will simplify matters for you. These rules aren't "break this rule and the computer will explode into a million pieces" type rules; they're not even "break this rule and I'll think that you are a bad person" type rules. Instead, they are "break this rule and the computer will probably get confused" type rules.

A computer keyboard acts just like a typewriter keyboard, with a very few special exceptions. You type a key on the keyboard and the corresponding character appears on the screen. The exceptions are what give people problems. One of these is the backspace key. This key takes you back one space, normally erasing the character to the left. This is the key you use to correct a typo &emdash; you just backspace all the way back to the typo and retype from there.

A very tricky key that causes no end of trouble with beginners is the control key. It is usually marked "Ctrl" on the keyboard. It doesn't control anything at all. It is really like a second shift key: you hold it down while striking a second key. What does this tell the computer? That depends on the type of computer, the program you are using, and very likely the phase of the moon. Control-X, for example, might delete a character in some situations; in other situations it might exit a program. How do you know what the control key does in your situation? You have to study the documentation. Oftentimes the only explanation of a particular control key combination is found in a footnote on a loose-leaf addendum that fell out of the binder when you opened the package. For now, a very good rule is: don't bother with the control key.

It's important to realize that the computer does not carry on a normal human-type conversation with you. That is, it's not sitting there listening to everything you type in. In most situations, you type in an entire command like "DO THIS" and then you hit the RETURN key on the right side of the keyboard. The RETURN key has a special meaning to the computer. It means "OK, computer, I've gotten this command just the way I want it. Go ahead and do it now." Lots of people will type a command into the computer and get mad waiting for the computer to execute it; meanwhile, the computer is waiting for them to hit the RETURN key to tell it to go ahead.

Sometimes when you are working with the computer you get stuck. You tell it to do something and for some reason it just sits there like a dumb ox. Or maybe you tell it to do one thing and it retorts with some idiotic question like "How many pages to print?" when you didn't want to print any pages. You tell it "no pages!" but it just keeps on asking for the number of pages to print. You type "0", "none", "nada", but it makes no difference; the computer wants to know how many pages you want to print. Getting stuck like this is very frustrating and has done more to slow the computer revolution than anything else. How do you get unstuck? Well, there is always a right way to get unstuck, some sneaky command like Control-Q that will magically solve all your problems, but it might take you forever to find that command in the manual. So it's good to know a few emergency techniques that often work, although they frequently have some nasty side effects.

The first emergency command is the ESCAPE key. Most computers place the ESCAPE key on the upper left corner of the keyboard. It's probably labelled "ESC". ESCAPE is supposed to mean something like "escape from this awful trap", and is frequently used as a fairly innocuous escape hatch.

If the ESCAPE key doesn't work, the next one to try is often the BREAK key. This key, if it exists on your computer, will probably be on the upper right corner of the keyboard; it might be called "BRK". Its name is misleading. It will not break your computer. It is supposed to mean something like "break off this line of communication". The BREAK key will almost always break you out of a BASIC program that's locked up.

Even more powerful than the BREAK key is the RESET key. This is a powerful and dangerous key. RESET usually means "Stop everything! Erase your memory! Start all over from scratch!" RESET will erase everything in the computer's memory: the program, the data, everything. The only survivors will be the programs stored in ROM and whatever you saved onto disk. When you use RESET, you are throwing away all the work you did since you last saved things to disk. But at least it regains control of the computer.

There are rare occasions when even RESET won't do the trick. Some computers don't have a RESET key. Sometimes the computer goes so completely bonkers that even the RESET key doesn't bring it around. There is always one last resort with any computer that has gone wild: turn it off. This is a violent and brutal tactic, akin to the determined leader slapping his raving underling with the command, "Get ahold of yourself, kid!" Wait a few seconds for the computer to completely forget whatever was driving it wild, then turn it back on. It will awaken calm, serene, and completely unaware of the wild or stubborn behavior that had possessed it only seconds earlier. Please, however, do not overuse this tactic; it's not good for the computer's chips if overdone. How would your body feel if, every time you made a tiny mistake, they put you to sleep with an anesthetic shot, and woke you up 5 seconds later with a cold shower?

These rules of etiquette with the computer are only general guidelines; in many situations they may not apply. But they are useful when you are in doubt and cannot find the correct course of action.


A COMMAND

Let's try something with the computer. Type the following command into the computer:

PRINT "HELLO"

This means that you should type the capital letters P,R,I,N,T, a quotation mark with two ticks, not one, the capital letters H,E,L,L,O, and another quotation mark with two ticks. When it looks right, press the RETURN key. If you typed it properly, the computer will print the word "HELLO" directly underneath your command. Thus, your screen should look like this:

PRINT "HELLO"

HELLO

Congratulations! You have just given the computer a command, and it has successfully executed your command. You have demonstrated who is the master and who is the slave.

Now try variations on the theme. Give it the same PRINT command, only this time, instead of the word "HELLO", try some other words. Try uppercase and lowercase letters; give it your name to print in some clever sentence. The general rule is simple: anything you put between the quotation marks, it will print. Try it.

Now let's try something else. Let's give it a new command, not a PRINT command, but a nonsense command. Make up something good, like SNARGLEBLAB, or XQYQKLZ, or whatever, then type it in and press RETURN. What happens? The computer will probably come back with a short, strange message. Most likely it will say "SYNTAX ERROR", but it might say something like "ERROR 23" or "HUH?" or some other indication that it is confused. Here you encounter one of the most important and frustrating problems in all of computing, the source of more frazzled nerves, lost hours, and smashed computers than all other sources combined. I refer to the scurillous, sinful,

SYNTAX ERROR

A syntax error arises whenever a command is misspelled or out of place, or in some way contains a flaw. To properly understand syntax errors and their implications, you must first understand some general principles of communications with flaws.

Consider communications between people, such as speech or writing. We normally think of such communication as being flawless, yet in truth all communications between people are full of flaws. The trick is, we are very good at filling in the gops created by such flaws. For example, in the previous sentence, I deliberately misspelled the word "gaps"; did you notice? If you did notice, it certainly didn't stop you and probably didn't even slow you down. Consider the process you went through when you read the word "gops". On first reading the word, you didn't recognize it. You probably went back and reread it to make sure that you got it right. Sure enough, it really does say "gops". OK, scan memory carefully: is there such a word as "gops"? No, there isn't. Well, what could it be? Here you went through a long, almost unconscious pattern-matching process, considering such possibilities as "gobs", "hops", "tops", "cops", "gods", and so on until finally you came upon "gaps". You realized that "gaps" fit the sentence perfectly, and so you mentally replaced "gops" with "gaps". And the entire process probably took you less than a second.

This kind of activity is very common in human communications. It is absolutely essential in understanding spoken language, for spoken language is a messy hodge-podge of words, phrases, and clauses thrown together in a wild jumble. Let's eavesdrop on a conversation between two people on a city street:

"Fine, uh, did you get the, uh, excuse me, the uh, package from Steve?"

"Steve, jeez, he's too busy. Yeah, I got a quarter. Sure. He gave it to Fred."

"What the hell's he need with it?"

"Hey, there's Tom. Hey, Tom, where'd you get that bump? No, he doesn't need it, he was just around when Steve needed to hand it off to somebody."

"So when do you collect from Fred?"

"Oh, two, three days."

You probably have very little trouble figuring out the meaning of this conversation. But if you were too look at it coldly, like an English teacher, why, you'd find all sorts of mistakes and syntax errors. Indeed, you could easily show that this conversation makes absolutely no sense.

Yet, it does make sense; you can figure out what's going on. How are we able to extract meaning from communications that are highly flawed? Some people give redundancy as the answer. Redundancy is the practice doing the same thing two or more times as a back-up. The reasoning is that a normal English sentence is redundant; it says its message more than once, so that if the message becomes garbled, people can still understand it.

There is much truth to the redundancy arguement, but I don't think that it hits the nail on the head. I prefer to think in terms of context. A word does not exist in isolation; it is part of a sentence. A sentence does not exist in isolation; it is part of a longer communication. And even communications do not exist in isolation; they are part of a relationship and part of the world. The sentence provides context for the word; the communication provides context for the sentence; and the relationship provides context for the communication. The context provides information that allows us to fill in the gaps in communications, to correct the flaws.

For example, in the street conversation, the pronoun "it" refers to the package. We know that even though we talk about other possible antecedents (a quarter, a bump), because the real thrust of the conversation is about the package, not the quarter or the bump. The context of the conversation tells us that. On a higher level, we are able to understand the comment, ". . .Yeah, I got a quarter. Sure . . .", only if we know something about city streets and panhandlers. Again, the context of the world gives meaning to an otherwise flawed sentence.

Now at last, I am ready to make my point about syntax errors. We humans are able to understand deeply flawed communications only because we understand the context in which they are made. But computers don't know anything about the world, so they don't have any context, so they cannot correct flawed communications as we can. Hence, the tendency of computers to be so frustratingly picayune, so infuriatingly narrow-minded.

Actually, computers aren't the only ones to exhibit extreme sensitivity to syntax errors. In the right circumstances, people can be just as block-headed. How many times have you heard this line:

"We're sorry, sir, but we cannot honor your request. You have not properly filled out form RC/22b, Authorization for Transmittal of Individual Confidential Information. Please review this form and fill it out completely and resubmit your application."

If you think about it, this is really the same response as the computer's "SYNTAX ERROR" plaint. Both the computer and the bureaucrat respond to a communication that does not fit their required format with the same unyielding obtuseness.

Just to be fair, let me throw in another example:

"If the moment of inertia tensor is not diagonal, unstable perturbations will develop."

Does this sentence make any sense to you? You have no context with which to understand it. How else could you respond to it other than to throw up your hands and say "Syntax error!"?

Whose fault is it in a case like this? Who has the responsibility for insuring that the communication gets through loudly and clearly? The speaker or the audience? We Americans, steeped in egalitarianism and a spirit of cooperation, tend to answer that both sides share responsibility for clear communications. I disagree, and I think that your experiences with computers will lend weight to my position. I think that the responsibility for clear communications falls squarely on the shoulders of the speaker.

In theory, the audience of a communication is supposed to give feedback to the speaker on how clearly the message is getting through. Thus, if you and I are conversing, and something I say doesn't make sense to you, you are supposed to say, "Run that by me one more time, please." This scheme insures that our conversation will move smoothly and efficiently.

In the real world, however, this seldom happens. Sometimes the audience doesn't want to appear stupid by asking a dumb question. Sometimes the listener believes that his confusion is temporary and will quickly abate. Sometimes the listener is so completely lost that he doesn't even know where to begin. Whatever the cause, he just nods his head knowingly and mutters, "That's fascinating".

How then can we communicate well if our audience can't be trusted to speak up when it is confused? There is only one sure-fire solution, and that is to assume very little of the audience. You must be pessimistic, assuming that everything you say is lost on the audience. You must drive home every single point with ruthless drive and determination. You must be a defensive driver, imagining what is going on in the mind of the audience, trying to guess where they might be tripped up next. This is the only way to communicate with confidence.

It is a hard lesson to learn, but the computer provides an excellent training ground. It assumes nothing, knows nothing. It has no context with which it can second-guess what you really meant to say. It can respond to your commands only in their absolute, literal sense. It will indeed drive you crazy. But it will also discipline you to think hard about exactly what you say. It is a sobering experience to have so many of your commands rejected as syntax errors &emdash; you never knew you were so sloppy a communicator. But once you learn to express yourself clearly and carefully, you will find that the number of syntax errors you generate will fall.

The lesson you learn in the process will benefit you in many areas other than computers. Precise communications are important in almost everything we do. How many arguements have you endured that were started by a misunderstanding? How many foul-ups have you gotten into because somebody didn't express themselves exactly? I well remember the time my father drove 30 miles to pick me up "at the Doggie Diner on Main Street". Neither of us knew that there were two Doggie Diners on Main Street. He went to one, I went to the other. If I had been more specific, the screwup would never have developed.

The most powerful demonstration of the crucial importance of precise communications is provided by an airline accident some years ago. As I recall, the tower had instructed the pilot, "Come down 3000". This was an ambiguous instruction; was the pilot instructed to come down to 3000 feet, or was he ordered to come down by 3000 feet? The pilot assumed the former, but the tower meant the latter. The pilot came down to 3000 feet; there was a mountain at 3200 feet; there were no survivors. Precise communications can be a matter of life and death.