Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do CamelCase with German words (or with any other language that supports compound nouns)?

Disclaimer: Feel free to close this as "too localized", if you think it is inappropriate for StackOverflow. Since there's quite a large German-speaking community here, I thought I'd give it a try.

CamelCase is used frequently in programming language conventions (method names in C#, public method names in Java, etc.). It's quite easy to do in English: You just concatenate the words and capitalize the first letter of each one: DisplayName, InternalName.

German, however, supports compound nouns in many cases. E.g., "Anzeigename" (DisplayName) is a single noun, but "interner Name" (InternalName) is not. So, the latter case is easy to camelify: It's InternerName, just like the CamelCase rules in English. What about the first case? One could

  • use Anzeigename, to keep consistent with German grammar, or
  • use AnzeigeName, to keep consistent with the look and feel of CamelCase and with other *Name-s, which are not single nouns.

Is there some guideline or well-established best practice on this?

I realize that just using English names solves this problem quite easily, but that's sometimes not feasible when developing domain-specific software, or when configuration files must be human-readable by people without good English language skills. It just doesn't make sense to make up an English translation for Umsatzsteuervoranmeldung, when you are certain that the software will only be used in a German language context...

like image 778
Heinzi Avatar asked Aug 31 '11 09:08

Heinzi


1 Answers

There is the same problem in English too.

For example Surname versus LastName

Use a captial if when written in the language there would be a preceding space

like image 192
Tom Carter Avatar answered Oct 07 '22 03:10

Tom Carter