Should you use international identifiers in Java/C#?

前端 未结 11 1453
遥遥无期
遥遥无期 2020-12-11 00:17

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 e

11条回答
  •  旧巷少年郎
    2020-12-11 00:28

    As already pointed out, unless method names mostly match the language, it is a bit weird to constantly switch languages while reading.

    For the Scandinavian languages & German, which I can speak and thus speak for, I would at least recommend using standard substitutions, ie.

    ä/æ -> ae, ö/ø -> oe, å -> aa, ü -> ue

    etc. just in case as others may find it difficult to type the original letters without keyboard/keymap changes. Think if you suddenly had to work with a codebase where the developers used a third language (for instance including the French ç) and didn't do this.. Switching between more than 2 keymaps to type efficiently would be painful in my experience.

提交回复
热议问题