Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should you use international identifiers in Java/C#?

C# and Java allow almost any character in class names, method names, local variables, etc.. Is it bad practice to use non-ASCII characters, testing the boundaries of poor editors and analysis tools and making it difficult for some people to read, or is American arrogance the only argument against?

like image 348
Jason Cohen Avatar asked Sep 14 '08 20:09

Jason Cohen


People also ask

Which of the following are not legal Java identifiers?

The only allowed characters for identifiers are all alphanumeric characters([A-Z],[a-z],[0-9]), '$'(dollar sign) and '_' (underscore). For example “geek@” is not a valid java identifier as it contain '@' special character. Identifiers should not start with digits([0-9]).

Are identifiers and variables same in C?

The identifier is only used to identify an entity uniquely in a program at the time of execution whereas, a variable is a name given to a memory location, that is used to hold a value. Variable is only a kind of identifier, other kinds of identifiers are function names, class names, structure names, etc.

Which of the following Cannot be used as the first letter to form a valid Java?

question. Digit cannot be used as “first character” in valid variable name. The programmer can use Underscore (_), letter or dollar ($) as the first in a variable name. For example: The variable name can be given as int $number = 10; here $number is a valid variable.


2 Answers

I would stick to english, simply because you usually never know who is working on that code, and because some third-party tools used in the build/testing/bugtracking progress may have problems. Typing äöüß on a Non-German Keyboard is simply a PITA, and I simply believe that anyone involved in software development should speak english, but maybe that's just my arrogance as a non-native-english speaker.

What you call "American arrogance" is not whether or not your program uses international variable names, it's when your program thinks "Währung" and "Wahrung" are the same words.

like image 110
Michael Stum Avatar answered Sep 21 '22 11:09

Michael Stum


I'd say it entirely depends on who's working on the codebase.

If you have a small group of developers who all share a common language and you don't ever plan needing anyone who doesn't speak the language to work on the code then go ahead and use whatever characters you want.

If you need to have people of varying cultures and languages working on the code then it's probably best to stick with English since it's the common denominator for just about everyone in the world.

like image 41
17 of 26 Avatar answered Sep 24 '22 11:09

17 of 26