Foreign language code

If your native language isn’t English you’ll sooner or later run into the issue of what language you’re supposed to write your code in. Confronted with the last system I worked in I haven’t seen any system which wasn’t written in English – but this system was to a large extent written in Swedish. This felt wrong on many levels with me but it started me thinking. Is the choice always clear cut?

While this article is going to be geared towards Swedish, I assume many of the same concepts apply to other languages. Either way, given the current audience of this blog, you’re probably Swedish too.

The case for English

The language itself

It’s going to be in English whether you want it or not. The only way around it is to program in a language with a preprocessor and #define all the keywords into your favourite language which must be universally evil. So you are going to end up with a pigdin programming language with the terms mixed up and it will not read naturally. Especially if your choice of programming language is something which really tries to be readable English and your native tongue has another word order than what English does.

The characters

I know that most modern languages support coding in unicode so you can actually name your stuff in Chinese, but I have never seen this in the wild. Even the humble Swedish characters of Å, Ä and Ö are notably absent even if they might be supported. So they are replaced with their non-embellished cousins which in Swedish are very separate letters indeed. Here’s a particularly evil real world example:

int Las();

I wonder what this function does? Could it be Läs, the Swedish word for Read? Might it be Lås, Swedish for Lock? Perhaps it refers to the law of employee protection commonly abbreviated as LAS? Who knows..

You can get around this by substituting ä with ae, å with aa and ö with oe. Those are the historical predecessors of our diacritical letters, but no-one uses those combinations any more, and it’s even less readable.

Translation issues

Another issue is that some things are not easily translateable, since they are in use with a third party library. Say your library uses a Table object and you want to write a function that goes and performs a check on the table. What are you going to call it? KontrolleraTable()? Or are you going to translate the word table too.

What the hell is a Mutex called in Swedish?

The case for the moon-language of your choice

With all this in mind, why does foreign language code still pop up from time to time? What is the irresistible pull?

Translation issues, again

Just like Mutex is pretty hard if not impossible to translate into Swedish it’s equally hard to translate Swedish business terms into English. If you don’t believe me, take a look at the field of accounting – something which I’ve been involved in pretty recently.

The Swedish word Periodiseringsfond has no real equivalence in the English language. It’s a genuine term, but it’s a legal one which is very specific to Swedish accounting law. Even the first part of the word, Periodisering is problematic. This actually is translatable into Accrual – but that term is completely unknown to most Swedes even though the knowledge of English is generally excellent.

Provided you need to create a class for a Periodiseringsfond, do you invent a word for it like AccrualFund – even though such a thing doesn’t exist outside of your program – just to keep to the rule of everything in English? This was actually the case for one of the larger systems I’ve worked with. That system had a pretty significant invoicing portion and it was all English. But some of that English was definitely a case of bogus translation directly from Swedish.

I’d love to see where the line is drawn – I’m sure that sooner or later every domain driven design made for a foreign audience will run into this problem.

Also, when you are dealing with your customers or users you probably want to have your developers actually talking to them. Are you unintentionally making a problematic conversation between a tech-oriented developer and a real-world user even harder by not even making them speak the same language. A bit part of the domain driven and behaviour driven design is to make this connection easier – are we missing the point simply because it feels wrong to code partly in a foreign language?

Because it does, it feels so damn wrong.

Advertisements
Tagged , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: