views:

142

answers:

5

Possible Duplicate:
Do you use another language instead of english ?

Few days ago friend of mine asked me to look at the CMS written in PHP. He asked me to review the code, and provide my comments to check if the company he hired did a good job.

Apart from few design and security related bugs I found one thing that annoyed the hell out of me: PHP code used both English and Polish language to name variables and functions.

As a native Polish speaker myself, I didn’t have any troubles understanding following code:

$szer=$x1/$max_image_width;
$wys=$y1/$max_image_height;

I know “szer” stands for “szerokość” and it means “width” and “wys” is “wysokość” - “height”. I found hundreds of similar examples:

function drzewo_kategorii_dod_prod($id_kat, $adres, $kategorie_tab) { ... }

..and I was thinking to myself – how the heck any other person who doesn’t speak Polish would be able to maintain this code?

I work in London so I am used to “English environment” and even though my English is not perfect, I believe that all code should be written in English. I’m ok with comments written in the local language, but for the god’s sake people... why do you mix languages in your code? We use ‘if’, and ‘true’ and all the English keywords.. is it worth introducing another language in the code?

Am I just being ignorant? Do I care too much about global code maintenance? Maybe it is ok to use local language for small high-school project, but what about serious business applications?

Did you experience similar issues? Do you write your code entirely in English or do you use your native language because it’s ‘easier’?

I hope I will never see:

bool jestCzerwony = prawda;
jeśli (prostokąt.szerokość == 70) { ... }

==

bool isRed = true;
if (rectangle.width == 70) { ... }
A: 

Even the French write code in english.

The only examples I have seen are in German (and it was an assmbler ISR for a serial port - imagine assembler in German!) and some Norwegian army stuff.

The Norwegian was worse, it was for official use and so had to be written in Norwegian, but in the other Norwegian languge that nobody speaks but is used officialy (????) - I later spoke to the programmer and they admitted they normally wrote the code in English then translated it once it worked.

Martin Beckett
(Nynorsk/Bokmål? One of them.) Meh, Western-centric ftl. See @Christopher Barber - http://stackoverflow.com/questions/2930319/code-maintenance-is-english-always-the-best-language-to-write-the-code-in/2930390#2930390
ANeves
I don't speak Norwegian - I thought the Norwegian programmer was winding me up!
Martin Beckett
+2  A: 

The best language to write code in is the one that is shared in common among all your developers. If you know all your developers know Polish, then it is ok to use that if you think it will make you all more productive. The big downside is that it would make it extremely difficult for you to include non Polish speakers on the team or to outsource any of your coding or low-level testing to non Polish speakers.

At my company, our main product (the Curl programming language &software platform) was originally written in the US but is primarily used in Japan. Ongoing development is being done in both Japan and the US. Our convention is to continue to use English in both code and comments for the main product. However, libraries and code intended for the Japanese market may use Japanese.

The reasons that English is the "lingua Franca" of programming is that most popular programming technologies were initially developed in English in the US, native born Americans rarely become fluent in a second language (sadly), while educated Europeans are frequently reasonably proficient in English. In countries like Japan, where English fluency is much lower than in Europe, it makes it a lot more appealing to program in Japanese.

Christopher Barber
I don't find anything sad about the fact that we don't become fluent in a 2nd language. I hope you get that sadness cleared up.
Rhubarb
It's sad because it makes us less competitive in the global economy.
Christopher Barber
@Rhubarb It's sad because speaking a second language gives you a much broader perspective on life.
deceze
+3  A: 

Yes I've seen it. And yes I thought it was quite horrible.

I even realized it is better to use comments in English - I had some code that had Czech comments and then wanted to post it somewhere and spent about 10 minutes ju8st getting rid of them.

Also I think as a programmer it is nigh impossible to get around without decent knowledge of english so you might as well just use it everywhere.

Jakub Hampl
Also it makes it easier to post your code to SO.
Jakub Hampl
+1  A: 

Yesterday, I was writing a routine that was supposed to take a set of four points in some non-standard order, and to reorder them into our canonical ordering. (These particular points came to us in bottom-left, bottom-right, top-left, top-right order, and we want BL, BR, TR, TL).

The only question I had was what to call the function. I was thinking canonicalizePoints, but a quick google of "canonicalization" showed me that the usual tech-geek's abbreviation was "c14n." Which resulted in a strong temptation to call the function c14nizePoints().

Seems to me that programmers can create sufficiently cryptic names, even if they stick to one language.

Jeff Dege
A: 

Interesting question, and I'm not sure just how many languages would even permit variable/function/class/method names containing non-ANSI characters.

MS Excel allows formulae using locale names for functions, so writing something like:

=ДНЕЙ360(ДАТА(2010;2;5);ДАТА(2010;12;31);ИСТИНА)

is completely valid if your locale language setting for Excel is Russian but this is purely a "display" format, and behind the scenes the formula is stored in English, so if I open that workbook when the locale language setting is French, I'll see the formula using French language names for the functions/constants.

It's a feature that I actually like, allowing for more cross-language portability; and I'd be interested in seeing a language IDE that could do something similar.

Mark Baker