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.

Tuesday, March 13, 2012

(Trying to do) Business in Canada

Over six months since my last post and what is it that gives me the kick in the pants needed to blog again? Not some advance in the field of chip verification; not an epiphany on how to spot future world class programmers from the way they play Plants versus Zombies. No, nothing so valuable. What's got me hitting the keys again is what always gets me hitting keys hard: government and how it can get in the way of Just Doing Business. I annoyed some people a few years back when I lobbed a few barbs at Germany for its anti-business funkiness. Well have a break Germany, cuz it's Canada's turn now, eh?

Enter Canada's Regulation 105. It goes something like this (subject to the usual IANAL caveat)

If a non-Canadian firm delivers a service to a Canadian client, then that client may be required by the Canada Revenue Agency to withhold 15% of their invoice payments, to cover possible Canadian tax. Now it's important to re-stress: the 15% withholding is merely provision for possible tax. In the case of a US firm, it is entirely possible -- likely even -- that if its affairs are in order (specifically, if it is not deemed to have a Permanent Establishment in Canada) it will be paying the relevant taxes back in the US and it simply will not owe any tax to Canada at all. In that case, at the end of the year, the US firm can submit a Canadian tax return and and request a refund of all the withheld money. But even though at the end of the day there may be no actual money owed to the CRA, 105 is still expensive, especially to the smaller company. Here are five reasons why.