In a previous blog post I mentioned the possibility for using non ASCII characters as part of identifiers. Nils Langner, who runs the German "PHP hates me (but that's ok)" blog, then wondered whether it makes sense to use German (in his case) terms for identifiers in code in the comments it was also discussed what language is best to be used in comments.
The argument for using only English is simple: Every developer should know at least basic English and using English helps when either outsourcing, opensourcing or reaching new markets.
Now there are arguments against English, too, one is that not all developers are able of using English properly so reading and writing comments is more difficult for them - now you don't have to write long prosaic texts in comments, but still ...
The other argument goes by domain-specific terminology. In some cases - for instance when bound to legal environments - such terms can't be translated properly. For instance when dealing with financial data accounting by US-GAAP differs in many parts from the German accounting rules: For some positions you find translations which have the same meaning but are calculated slightly different so using the English term would imply the values would be calculated by the US rules (sorry British folks for this example - I have no idea about the British terminology and accounting rules, but have basic understanding of German rules and US-GAAP
). Ignoring this problem you still have to consider that you'd still talk German to your customer so the customer would use German terminology and you have to keep a dictionary for these terms which is a pain for everybody involved.
So now one could use mostly English with some local terms which gives a nice mixture ("function getEigenkapitalrendite()") or invent complete new terminology ("function erhalteEigenkapitalrendite()") which is stupid in comments, too ("The Eigenkapitalrendite is depending on the Gewinn and the Eigenkapital") ...
Now I'm in the "lucky" position that most things I do these days are either done for some American company or a popular world wide used open source project and is mostly about stuff where the typical terminology is English so I can use my bad English everywhere - but I'm curious what others are doing and what others think.
Monday, August 3. 2009 at 19:32 (Reply)
However I tend to translate between the Domain Terms and English, although i had too many occacions where this was a very bad idea and has lead to developers speaking in different terms than the customer.
Its really an annoying problem, writing functions, methods and variables in non-english feels very strange with the computer terminology nearby, pattern names, keywords and such.
Monday, August 3. 2009 at 19:36 (Reply)
Monday, August 3. 2009 at 21:02 (Reply)
If you write for Americans, or at least an app that is going to display things in English, you could go by the rule of thumb and ban your own language from the code.
And then there is the problem with urls. You might like to have a http://beispiel.de/seite/1 more than http://beispiel.de/page/1 because it feels more natural. The use of non-english is then actually the better choice.
Anything goes, as long as you stay consistent.
Tuesday, August 4. 2009 at 03:39 (Reply)
It never was a big deal where I work and coworkers use to do the same mistake too. It's never critical for us so we don't really care. We never did international apps but only one language applications (french or english but never both or more).
Our only rule is just to never use non-ASCII characters in URL / function name / class name.
I just hope I will never do myErsatzOfFonction() or jourIsInFerien() :p
Tuesday, August 4. 2009 at 12:03 (Reply)
If there are terms that are hard to translate, they are kept in German because translating them would really confuse people. There may be functions like getEinDeutschesWort(), but they are rare and ok in those cases.
Friday, August 7. 2009 at 10:26 (Reply)