7

I noticed that in this book on bioinformatics with Ruby (the programming language!) (Rubyではじめるバイオインフォマティクス―生物系のためのプログラミング入門), the authors sometimes used romanized Japanese in code examples. For example it sometimes uses hairetsu_1 for the variable name of an array (that'd translate as array_1).

When not programming in English, do Japanese programmers use a consistent romanization scheme, and if so, which one?

8
  • Perhaps we could expand this question to include all Japanese on what's the most commonly used scheme they use when forced / choose to type in romaji on computer?
    – Lukman
    Oct 3, 2011 at 7:05
  • really not sure what you mean by "in code" (comments? variable names?), but the answer lies more in encoding and compiler issues (the vast majority of languages only support ascii character in parsable code). Little to do with Japanese usage at any rate.
    – Dave
    Oct 3, 2011 at 7:19
  • Somehow, the amazon link is not working correctly. The method suggested by YOU in meta meta.japanese.stackexchange.com/questions/256 does not seem to be working here. Can someone fix this?
    – user458
    Oct 3, 2011 at 7:54
  • 1
    @sawa I think he's referring to naming variables, functions and classes in romanized Japanese, for example: gakusei.denwaBangou instead of student.phoneNumber
    – Lukman
    Oct 3, 2011 at 9:05
  • 1
    @Dave: Actually, Unicode identifiers are supported in some of the more recent popular languages like Java and C#. There are thousands of programming languages out there, but most code is written in just a few...
    – Zhen Lin
    Oct 3, 2011 at 9:25

2 Answers 2

8

I agree with Matt that there's no fixed standard about which romanization scheme to use. My guess is that it depends on the project, author, term and the author's swing of mood at the moment, just as in any other context of Japanese romanization.

[Personal point-of-view] If I were to use a Japanese variable name, I'd use Hepburn-style romanization, because it feels more phonetically consistent. However, when typing hiragana/kanji text through an IME, I mostly use Nihon-shiki to save keystrokes. [/Personal point-of-view]

Now be warned, my point-of-view can be biased, especially the first part, according to my work-partner. Let me share his story here.

I first asked him why his code is entirely in English, although he's not very fluent in it. He answered:

That's because at the first company I worked for, about ten or more years ago, the predominant attitude toward Japanese naming in source code was "embarrassing." (はずかしい)

To be precise, there were two groups of programmers in the game industry then: (1) Those who habitually used Japanese. (2) Those who thought it embarrassing. I don't know but there seemed to be a trend going against using Japanese among the younger programmers around that time.

Me: Were there any fixed way to romanize those Japanese variables? Like tsu vs tu?

Yeah, they used tu [Nihon-shiki] exclusively. I think that's all they knew, what they learned at school. [*]

Me: But what about fuga, as in hoge, fuga, piyo? (Common metasyntactic variable names among Japanese programmers.) Shouldn't it be huga, if you want to be consistent?

Ah, these came from an entirely different class of programmers, those who'd been in the field for ages, near-bilingual, programming-language-lovers. They know English, they're very careful about spelling. We [game programmers] didn't know or care about these meta-vars. We'd just use a if we needed a placeholder.

So to recap, any of the following can affect the choice of romanization scheme: perceived phonetical consistency, keystroke efficiency, local culture, school curriculum, or convention. (Again be warned that this nice-looking summary is the result of a survey with a sample count of only 2.)

[*] Kunrei-shiki, a variant of Nihon-shiki, in fact, is the one taught in elementary schools. ref: wikipedia

8
  • What are the literal meanings of the Japanese metasyntactic variables btw? Or are they as meaningless as the English ones? :) Oct 4, 2011 at 11:00
  • @KarlKnechtel I don't think any of them has a concrete meaning, but fuga and piyo, when repeated, are valid imitatives (擬態語 [ぎたいご] / 擬音語 [ぎおんご] ): fugafuga, piyopiyo. pakeratta probably comes from a fictional character's stock phrase (ref: chiebukuro)
    – ento
    Oct 4, 2011 at 16:34
  • "imitatives"? Like onomatopoeia or something? Oct 4, 2011 at 22:43
  • @KarlKnechtel "onomatopoeia" - Exactly. Japanese has separate terms for sound imitation words (ぎおんご) and sight imitation words (ぎたいご) and I hoped to capture both by "imitative". But all the English definitions of "imitative word" I can find seem to lean towards sound imitations. hummm
    – ento
    Oct 5, 2011 at 1:41
  • 1
    @KarlKnechtel in fact, you do imagine it, it's very common: en.wikipedia.org/wiki/File:Booba-Kiki.svg
    – Axioplase
    Oct 7, 2011 at 11:17
4

I don't think that there is an absolute industry standard ("programmers" can't even agree on the best way of indenting code...), but in my admittedly limited experience, Word-processor-style, influenced by Nihon-shiki, is most common. Thus, 東京 is "toukyou" and "情報" is "zyouhou", "普通" is "hutuu".

Pure speculation: This might be because if you romanize things this way, it's exactly the same as entering the words in your IME (without the IME step, of course), and so the amount of effort required is minimal.

(Incidentally, I am talking about function and variable names here, in languages where these can be set relatively freely, like C++ and Ruby.)

2
  • 1
    I agree that the romanization in code probably comes from romanization used in IMEs. However, IMEs accept both “zyouhou” and “jouhou,” and therefore I do not know whether/why many people choose Nihon-shiki romanization. Oct 3, 2011 at 10:31
  • @TsuyoshiIto That's a good point. In general I concur with ento's (superior) answer: the people I'm thinking of are relatively young and don't care about English at all, so it doesn't bother them that English speakers would find "joho" easier to read than "zyoho". They just go with the logical system that they learned in school (at least in the years they weren't taught by a teacher who preferred Hepburn or whatever).
    – Matt
    Oct 3, 2011 at 23:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .