Thursday, March 29, 2012

On mats, and cats, and programming

You are a teacher of C++ or any of a number of similar languages. You are marking an exam. The first question is, "Write code to add 1 to variable x."

Candidate A's answer consisted primarily of the following:
x = x + 1;
Candidate B had, by contrast:
x++;
I'm guessing, but I reckon the majority of examiners would find no fault with Candidate A's answer. They'd do that because by most standards, there is nothing wrong with Candidate A's answer. It means exactly what it was supposed to mean. It says what it was supposed to say.

Now; you are a teacher of English As A Foreign Language[1]. You are marking an exam. The first question showed a picture and the following jumble of words: "mat", "the", "sat", "cat", "on", "the".


The candidate had to "Rearrange the word jumble to match the picture."

Candidate A wrote the following:
On the mat the cat sat
Candidate B had:
The cat sat on the mat
I'm guessing, but I reckon the majority of examiners would find fault with Candidate A's answer. They'd do that because by most standards, there is clearly something wrong with Candidate A's answer. Although it means exactly what it was supposed to mean, and says what it was supposed to say, it's wrong. It's not how English is spoken by English speakers.

The difference is simple. In natural languages, idiomatic correctness is seen as being part and parcel of overall correctness and we don't stand for it when it is missing. By contrast, we seem to tolerate its absence in programming languages?

Why?


[1] I chose EFL instead of just English for my example, because lets face it, the more enlightened examiner may give more marks to "On the mat the cat sat" to reward its more poetic quality, a quality lacking in the idiomatically correct but more mundane, "The cat sat on the mat". But EFL is, sadly perhaps, more about simply getting on in English speaking environments than about writing poetry.

No comments:

Post a Comment