Third Big Idea: Precision of Expression

You may have already noticed that Javascript is totally intolerant of any deviation from its grammatical rules. For example, consider this ordinary-looking line of code from your first program:

    var myCanvas, context;

Why does it have to have a semicolon at the end? The end of the line is perfectly clear from the text. But try taking out the semicolon, so your line looks like this:

    var myCanvas, context

It won’t work. Talk about picky! The same thing goes for that comma after ‘myCanvas’. If you leave it out, the program won’t run. Indeed, almost any change you make will cause the program to fail. Only a very few changes will actually work. In most cases, the changes can make sense to you, and should be obvious to the computer, but it still refuses to run the program. 

The lesson to learn here is that programming requires absolute precision of expression. You MUST follow the grammatical rules exactly, without the slightest deviation. Any such deviation from the strict rules of the programming language’s syntax is called a syntax error. This requirement is intensely frustrating for most beginners, because our recognition of language is so forgiving. Most people slop their words together in vaguely coherent jumbles, and their audience can usually figure out their meaning. Computers, like Emperor Palpatine, are not so forgiving. Programming forces you to think through exactly what you mean to say, and express your meaning precisely. This brutal lesson is ultimately much to your benefit, because a great many problems people have with each other arise from poor communication. 

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. Both the computer and the bureaucrat respond to a communication that does not fit their required format with the same unyielding obtuseness.

Communication Responsibility
Whose fault is it when communications fail? Who has the responsibility for insuring that the communication gets through 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 habit 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, “OK”.

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.

Sad to say, few people are aware of how confusing their expressions can be, even when writing. Just cruise any discussion board on any topic, and you’ll find dozens of examples of slovenly phrasing. The rule that so many people fail to grasp is that you must ask yourself how the audience will interpret what you just said or wrote. Put yourself in their shoes!

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 — 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 arguments 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.