21

Possible Duplicate:
Do people in non-English-speaking countries code in English?

I am from the Netherlands and we speak Dutch.

I have worked on quite a few projects now in various languages, and I must say what always annoys me is the mixing of Dutch and English words in the naming of urls, variables, classes, files, db tables and db columns. Besides the mixing there is alot of bad use of words and bad grammar going around.

I reckon if you work with an international team the code HAS to be in English, but since I never do I often see people use Dutch words for database columns and variables. This is mostly because the requirements are written in Dutch, most of the data is also Dutch and, of course, the developer thinks in Dutch.

How do other non native English people tackle this? Do you just live with it? Do you develop everything in English and do a translation afterwards for the GUI and urls? Is there a code checking tool/approach to see if a developer actually used a proper word to describe something?

2
  • 1
    I have no such experience, however I am not an native English speaker and I always use english. Most books, tutorials, manuals come in English and I have learned to think in English, why bother with translating in my head all this reading material. Besides English has often times short words, which is good! If I was to lead project I would insist on naming conventions.
    – Melsi
    Oct 16, 2011 at 0:49
  • 6
    I'm still very happy I haven't come across Chinese code yet. public 漢語 get漢語();
    – M Platvoet
    Oct 25, 2011 at 11:03

13 Answers 13

10

Talking about a good decade of coding...

I always code in English, because thats to me the native-code language. It is so in every serious programming text, and also all the scientific and non-scientific literature is in English.

Everything that is code, data, whatever is English.

Strings and display text etc. is localized (with placeholders in English, too). The first final product is always English. Localizations follow (which usually are just added string files).

6
  • 3
    Do you get your requirements in German? and if so, how do you handle words that can't be translated or have multiple translations in English?
    – Benjamin Udink ten Cate
    Oct 16, 2011 at 0:56
  • 1
    Actually the requirements are usually in English, too. A good deal of projects I've been working on so far are indeed sort of international with companies from all over the world contributing. So the English language is the common ground for all participants. In the cases where everything is in German (except the code) I never came across a case where it wouldn't be possible to think of a English word for say a function or variable or class...
    – cli_hlt
    Oct 16, 2011 at 10:26
  • Usually, a good translation can be found on the internet. Sometimes you have to use a somewhat awkward translation, but that is always better than having a double language mix. But this is a rare case in my experience. A lot of stuff is more or less standard (e.g. users).
    – jeroenk
    Oct 24, 2011 at 9:41
  • Every serious programming text - you mean most: IIRC Matz leaves comments in Japanese in Ruby's source code. But I agree that the best is to pick a language, and keep all code (and, if possible, artefacts) in that language - no mixing!
    – ANeves
    Oct 24, 2011 at 20:51
  • You say you get your requirements in english. But what if your users and your requirements are in another language.
    – Gilles
    Oct 25, 2011 at 20:15
13

The strategy that I have found best is to have the domain specific vocabulary in the native tongue, in my case Norwegian, and everything else, including code comments, db tables, file names, etc in English. If a database table or file has, as part of its name some domain specific word, that word is still not translated. This means that one can encounter names like barnepensjonMainTable (Barnepensjon is an extra pension one gets if one is retired in Norway and has a child under the age of 18 if I recall right), which on the surface looks silly, but is easy to understand for a native speaker, and uses the native domain specific vocabulary. This means that, based on variable names, file names or other info one can ask the domain experts about the term with no (possibly lossy) translation.

The main key here is consistency. Just all all non-domain specific words should NEVER be in the native tongue, domain specific words should NEVER be translated. On large projects this is especially true since different (well meaning) programmers can translate domain specific words into a bewildering array of similar words. This breaks any "search in all files" and adds confusion.

For smaller projects I use all english.

For mixed-language projects that break the above principles, I just try to extend whatever principles that project uses, as consistency is more important than the above principles.

2
  • 2
    I agree. I have worked on two different projects, where the domain concepts were legally and culturally specific to the native language. In the one case, we tried to translate everything to English. In the other, we kept the Danish terms in the code (and kept everything non-domain specific in English). And although mixing Danish and English was not pretty in the code base, it was still more valuable to have a precise domain model. Keeping the Danish terms in the domain model is essential in allowing developers to speak to domain experts.
    – Pete
    Oct 25, 2011 at 12:05
  • The is really the best awnser. Otherwise you ran into cases where programmers are using entities/classes/tables in english but the clients/users/business analyst aren't. You then arrive at situations where a programmer is speaking to customer about a core concept of the domain, an entity frequently used, but they do not understand each other because one is used to using the english word and the other the non-english word.
    – Gilles
    Oct 25, 2011 at 20:17
6

I've seen some code (OCE, Salome) that was written by people who were thinking in a foreign language. They didn't mix languages very much, but when they did it made it very hard to run the comments through translation software!

Bottom line - stick with one language. No abbreviations, no slang, and use common words and proper grammar. Do that, and I can get the gist of your comments and variable names with a translator and/or with an educated guess.

1
  • You can also run spell checking on the code (ItsNotEasyToDo_With$ThingsLikeThis though) and have a black list of words.
    – Alex
    Oct 22, 2011 at 12:23
2

I have experience of this being the native english speaker receiving code written by programmers from other countries.

I think it is just good practice to write your variable names / table names etc in English for a few reasons. You never know what is going to happen in the future, the code which you are working on now may be just for an internal project, but it may also be passed off to another office in the future or it may be something you or your company decide to sell as the product grows.

Having your names in english means you can pass off your code to not only native english speaking devs but any developers you may meet, English may not be their native language but they will understand enough generally to get the idea of what your names mean.

Whilst programmers may struggle with some names in english GoogleTranslate and / or a dictionary is generally enough to accuartely translate single words. Since english does not have masculine / feminine words it isnt too hard to get the names correct or close enough.

Having English names also makes it easier to outsource work and / or get support from external parties. Imagine you have to integrate something into your code you have no experience of and decide to outsource this to another programmer. If your names arent in english this programmer either has to bug you to find out what things mean or translate it themselves, both of these options waste time.

From my own history I have recently worked on code which was written by a french company, all the database tables / columns / report names (and text) etc were in french, given that myself and the colleague I was working with had very little knowledge of the language we had to constantly use GoogleTranslate, this slowed the entire task down, eventually we did learn some of the words but it made the task a lot more tedious and long winded than it had to be. Had the initial developer considered this when developing this database our task would have taken half the time.

The GUI is best to write using resource files to contain your text, that way you can easily have your software support multiple languages. Whilst this may seem overkill for some projects it is nice to be future proof and for the little extra effort you can future proof your work in a way.

The only place I would say it would be acceptable to use non english names is maybe in website design where the user will see the complete URL with folders ie www.yourURL.com/subfolder/filename.htm in this situation if your website is not for an international audience it is appropriate to use non english file / folder names.

All of the above should ideally be part of a well planned coding standards document which not only includes the language to name things, but also which case to use and the gramatical style.

1

Following my personal experience with this:

I've seen a loot of projects that are exactly programmed as you mentioned; two languages, slang's and custom shortcuts and all that mixed up from persistent layer to the presentation layer.

At the time I started in the company I am still working at I declared English as programming language for all new projects. That was hard at the first time and much code need to be revised but it worked after 3 Month at least. Now all projects are written in English from the Database Tables over the exception handling to the Fronted (Some projects still require just one language so that here English get still skipped in some projects).

I have to mention that we are developing with .NET and the resource files are an important pillar for this setup. Nearly six months after I started this all programmers agreed that the code is now better to read then before and the developing process is as fast as before. For sure you are thinking in your native language but it needs just a little bit of training to write all in English. The Project Documentation outside the Program code get of course still written in our native language.

With the use of the resource files it is easy to translate our projects while all other parts doesn't need any change cause we declared the programming language to English, so no Database table or variable will need a translation. Not to mention that every programmer should follow basic rules to name short and straight.

1

My experience here in Brazil is that many people I've worked with tend to mix portuguese and english a lot, be it variables, classes, database columns, function names, etc.

Though, to be fair, portuguese is easy to put into coding language, as we can easily read missing accentuation marks such as ~ or a ç. For instance, "promoção" would turn out as 'promocao' for coding purposes, and any programmer could look up at it and guess "it's actually promoção".

Personally, I'd say that, unless your native language uses lots of special characters, and their presence or ausence makes all the difference, use mainly it, sticking to english only for convention things such as "get" and "set" for Java. Unless you're developing for foreign clients. In that case, full english is your best option.

0

From what I've read, non-English natives tend to agree that the best practice is to write all of your code in English (the GUI can remain the same). This is not only because most programming languages are in English, but because English is a highly-technical language, thus you can be very precise and unambiguous in your naming conventions, comments, etc.

2
  • 1
    this is offcourse true for non English speakers who speak perfect English, but as you may or may not know, most don't. Being able to write code is not quite the same as being able to write a technical English text.
    – Benjamin Udink ten Cate
    Oct 16, 2011 at 0:49
  • 2
    I write my code in English because it's a widely spread lingua franca; most coding non-English speakers who speak another language would speak English. However, I fail to see how English is "highly technical". It's conveniently terse, and has no gender or declination, which is practical.
    – Mathias
    Oct 16, 2011 at 0:55
0

I am always naming all identifiers in program in English. I am non-native english speaker. If I don't know the right word for specific variable, I just use online dictionary to find right one.

GUI is either single-language (if it is not meant to be internationally used) or multi-language (with locale text files, or something like that, depending on platform).

0

Don't mix up programming and GUI/other user interaction. For a programming language, you have to use the most easier and simple language without any accent or other stuff like that. For example, you couldn't program in Japanese with romanji writing as you would have serious issues with accents influing on pronounciation.

The best for now is still English (I'm not familiar with other languages), I work in a French programming team and whenever someone use a french noun for a method name it's a mess because accents are really important in French. That's why we use English. Bottom line is, you can use whatever language as long as you can write it in pure alphanumeric (a-z0-9). Or you could use a programming language/compiler that accept every chars in syntax but I don't know any.

0

I am from Israel, my native language is Hebrew, and I always program in English.

It's just much more comfortable (though Hebrew is rtl while English and Latin-based languages are ltr, so it makes it a pain to read if it's in Hebrew, I don't know how it's like in ltr languages like Dutch).

I find it much more efficient.

0

When I started with programming I prefered Czech (my native language). It was more obvious what is some language feature or library function and what is purely my choice of name. I especially liked it for examples that I adopted - it was clear what has to stay and what can be chaged.

Now I prefer English even if it is only my personal project. It seems more fluent with the language keywords and library functions. If I do not expect future need of localization I write the strings directly in GUI language. Sometimes I use inconsistent language for comments - English for documentation and Czech for remarks and todo: notes. I use specific czech characters like ěščřž (valid name in C#) for one purpose debugging variables - it makes them easier to find later since I dont use them anywhere else in the code.

0

This is the rule I use:

1- Domain specific terms are always in the language of the customer/client.

2- Computer terms are always in english.

My firs language is french. My clients write their requirements in french, they speak in french, the gui is in french, etc.

If you put everything in english, you have some mental mapping where the application display the french word "Avis Juridique" for example, but these are stored in a database table whose name is in english, say "Legal advice" (google's own translation).

What can happen then is that developpers speak to the users with the english terms, and the clients have no idea what the developper is speaking about.

Worst the translation can be misleading. For example in the transalation I mentioned earlier while Avis can mean Advice, that may not necessarly be the correct usage I am looking for.

If I have a factory of "Avis Juridique" I will call it AvisJuridiqueFactory.

0

I started in a German code base, but when my company becomes more international, developers should document everything in English. Some do - other do it not. Those who worked in international teams switch to English.

I write all my programs in English, even programs for German use only (often they start German-only, later they are needed in other countries).

When I have complex code I switch to German. If I have problems to explain something in my mother language I don't try to explain it in a foreign Language. I add a short (or long) English explanation and add the German documentation, just in case I don't understand my own English.

Not the answer you're looking for? Browse other questions tagged or ask your own question.