I was wondering about this. Because I think I had to comment my code in english if I ever make it public so that people could understand the code.
But it is also a problem because I have to think a lot more to comment my code in english and it makes the coding process slower, also it is slower if I go back to some code I wrote long ago to understand the comment in (poor) english I made.
So I think it should be easier to just comment in french (my language) but then some computer related terms are just untranslatable !
So I end up mixing english and fench in my comments and I don't know if this is a good idea !
Especially becuase I always use english variable names, if they were in french it'd be ridiculously long and unpractical.
I write comments in English (and don't do it enough) But to me it's almost like a native language...so it's not really a problem for me.
Guido van Rossum, benevolent dictator of the Python programming language, is Dutch, but he comments in English according to
PEP 8:
Guido wrote:
Python coders from non-English speaking countries: please write
your comments in English, unless you are 120% sure that the code
will never be read by people who don't speak your language.
When programming, I write everything in english: variables, comments, documents, everything. Not because I want people from around the world to understand what I do, but because I think english is more concise and less ambiguous than portuguese, making it more efficient for describing technical things.
The only exception for me is at work, where not everyone speaks english and we make things that deal with real-life things that only exist in our country, so it would be really silly if I tried to describe such things in english.
It depends from purpose of the programming. If it is something that is going to be released and going to be useful for people from the whole world - in english, if it is something for personal use or is useful for local use only - in my native english. I usually don't comment code for personal use too much, though.
Commenting code in english does not slow down the process, because it is rather formal, with limited set of worlds (this does that, this changes that etc) - it is not a poetry or something.
Everything in english.
My mother language is portuguese-br, but I'm always writting C code using english, always. I have no special reason for it...
"Sometimes english, sometimes my native language"
Actually, it depends on what is shorter.Sometimes I even write mixed sentences.A for source code-I don't belive anypne will even look into it.
All English for me for the same reasons tokumaru mentioned.
I can't even talk about anything computer-related in German without constantly wishing for words as precise as their English counterparts, so I end up with long sentences explaining everything which makes communication in my mother language take longer.
Then again, I suck at everyday conversations. I'd die of hunger having an American breakfast because I wouldn't know how to ask your Dad if he could pass me a particular thing whose English name I forgot.
English is my native language, but I've always been impressed that so many non-native-English coders make the effort to leave English comments. I don't expect/demand it, but I do appreciate it. (Non-English comments I attempt to translate if I need to; at least the internet has made rough translation fairly easy these days.)
On a related note, my brain seems to automatically write comments in Canadian English, but uses U.S. spellings like "color" and "center" in the actual code. This may be confusing.
I'm surprised how many of you comment everything in english.
Before I commented in english but I figured it slowed down me a lot and I made crappy comments anyways.
English is okay to say "this does that" etc... but when I'm doing complex things involging jongling with the X, Y regs, stack and various temporary variables (which about any routine with deals with complex maths does), it's complex to explain it to myself in english so I prefer using french so I can just write it down and read it without thinking too much.
Bregalad wrote:
when I'm doing complex things involging jongling with the X, Y regs, stack and various temporary variables (which about any routine with deals with complex maths does), it's complex to explain it to myself in english
I'm the exact opposite... I have a lot of trouble explaining in portuguese things that would need really simple and small sentences in english. I find that portuguese either lacks words to properly describe programming concepts or the words that do exist just sound weird. "Scrolling", "array", "register", "mapper" and "bank switching" are examples of things that sound really weird in portuguese, at least to me.
English also has some handy shortcuts that make it easier to describe things... For example, you can say "memory-mapped registers", and you only need the dash to connect the words. In portuguese you absolutely need a preposition to connect them: "registradores mapeados
em memória". Not only individual words are usually longer (see "registradores" vs. "registers"), but you also can't take shortcuts that are possible in english.
I think if you are releasing code into the public, English is the most universally accepted, so I would recommend English comments in that case. However, if it's just for your own viewing, it's best to do what's easier for you to understand.
Like Tokumaru was pointing out, I think a lot of programming concepts are easier to explain in English. Plus, programming languages are usually much like English, so commenting on it is often like expanding on what the line of code says by itself.
I also can't help but feel like the same words feel a lot more organic in other languages, which throws me off. Like when I read "memória" in Tokumaru's post, I had a hard time thinking of RAM instead of someone's mind. Maybe that's just me, though. Plus I'm not really one to talk because English is my native language.
I live in the USA, And most of us speak English, so I think if anyone were to use only English to comment code, it will make complete sense to 98% of the people, Making it readable for the most part!
English is really the most hard, but yet ESSENTIAL language to learn because of it's semi-universal use.
I'll only write comments in English ever, not only because this is easier for me to type and for others to read, but putting anything but English (or, better phrased, anything but standard ASCII) in a plain text file will just mess things up (unless you need to put string messages in another languages in your codes). Accented characters and C/J/K characters aren't actually guaranteed to be displayed correctly when the files are opened in a different system. For example, if you open a Japanese text file with notepad (and even notepad++) in Chinese Windows, 99.95% of the time the Japanese text will only appear as corrupted gibberish. Even opening simplified Chinese files in a traditional Chinese system won't work. (That's why I use Applocale and create shortcuts for launching notepad, command prompt, 7-zip manager, etc. in different languages.)
The introduction of Unicode actually doesn't help much. This problem still persists most of the time.
Celius wrote:
I also can't help but feel like the same words feel a lot more organic in other languages, which throws me off. Like when I read "memória" in Tokumaru's post, I had a hard time thinking of RAM instead of someone's mind.
I think I know why that might be: the example sentences used in foreign language classes refer to organic subjects. They don't try to teach a language and computer science at the same time. Imagine how "Memory, all alone in the moonlight..." must sound if you've been installing RAM all day in a computer factory.
Gilbert wrote:
The introduction of Unicode actually doesn't help much.
I think I know why that might be too: Microsoft prefers UTF-16 over UTF-8. Writing foreign language comments in BOM-less UTF-8 is probably the cleanest way to do so in programming languages that expect the program to be written in ASCII, and it appears common practice on UNIX. But as I understand it, it isn't possible to set a Windows app's default code page to UTF-8 the way it is with certain other multibyte code pages such as Shift JIS. Furthermore, Windows Notepad forces you to insert the BOM whenever saving a UTF-8 file, which causes programs to fail to compile because compilers don't know what to do with a BOM that isn't marked as a comment.
tokumaru wrote:
"Scrolling", "array", "register", "mapper" and "bank switching" are examples of things that sound really weird in portuguese, at least to me.
Rolagem, matriz, registro (endereço de acesso e/s), mapeador (de memória) e trocas de bancos (de memória).
Eu evito português simplesmente pelo hábito e pelo uso praticamente universal do inglês, principalmente em programação.
--------
I avoid portuguese usage simply by habit (of always in english) and by the universal english usage, mainly in computer programming.
I have mixed feelings about english language. It's true you can say things shorter, and I think french is gramatically close to portugeese, something like "memory-mapped register" is shorter than "registre aloué en mémoire".
Some computer science like "scrolling", "buffer", "sprite", "frame" or "bankswitching" are just untranslatable ! Or if a translation exist it just suck, for example "scrolling" could translate in "défilement" but this sounds weird so I just use the english words and I end up with "frenglish".
Then there is also other non-computer science related words, such as "Snowboard", "Skateboard", which are untranslatable (read : all attempts at translating them have failed) so this is nothing new.
By the way it's funny some untranslatable words are transated with another, unrelated, english word. For example "sneakers" translate in french to "baskets", so everyone here thinks "baskets" means "shoes" in english, and it's a big shock when you learn it's not the case !
Back on the subject, it might not sounds like it for you guys, but I'm really not all that good in english and it takes some throught for me to read and write something in english language, when I can just type down my throught in french without thinking and read it back, it'd be useless to do all the effort to do it in english if nobody is ever reading my code.
Especially since I don't comment much technical stuff (because it's obvious at looking the code) but more what I tried to do and what routines does... and this is quickly complex to write in english for me.
I agree that plain text support for non-english characters suck. Again, the ego-centrist of americans at it's peak. It's common I have problem with accented charatrers, which are not avoidable in french language. You can write without them but it looks weird. However if I use accented caracters with notepad++, and always use notepad++, chances are this won't be a problem.
Bregalad wrote:
Some computer science like "scrolling", "buffer", "sprite", "frame" or "bankswitching" are just untranslatable !
I looked up "frame rate" on English Wikipedia, and the title of the corresponding French Wikipedia article was literally "images per second". "Sprite" in computer graphics is translated as "sprite" on fr.wp. As for "bank switching", Wikipedia's article links to "expanded memory", a standard for bankswitched RAM expansion on 8086 PCs, and the French term for that is "mémoire paginée" (paged memory). The
Nintendo Power article about how Game Paks work uses a "pages" analogy as well:
Quote:
To understand Bank Switching, picture a game as one page in a story book. The first thing you'll notice is that you can only write so much on a single page. A one page story might be okay, but if you want to expand the story, you'll need to add more pages. It's the same with games. Program size is limited, but you can add programs to the chip. Bank Switching allows you to have several programs in one chip. When a new area of the game is reached, you'll automatically switch to the appropriate program, which is useful in big game with many variations or worlds.
Extending the "one page story" analogy, where NROM games are like short stories and UNROM/MMC1/MMC3 games like novels, would turn a multicart into a short story anthology and WarioWare microgames into flash fiction. But now I'm way off on a tangent.
Quote:
Or if a translation exist it just suck, for example "scrolling" could translate in "défilement"
Yeah, a lot of French technical terms have "interesting" connotations. A "buffer overflow", for example, is "dépassement de tampon". In English, a "tampon" is a cloth plug to absorb menstrual fluid.
Quote:
For example "sneakers" translate in french to "baskets", so everyone here thinks "baskets" means "shoes" in english, and it's a big shock when you learn it's not the case !
Probably a contraction of "shoes for basketball".
Quote:
if nobody is ever reading my code.
So pretty much your entire answer to the question of this poll is likely to depend on the answer to another question: "Do I expect someone not sharing my native language to collaborate with me on this project?"
Quote:
In English, a "tampon" is a cloth plug to absorb menstrual fluid.
In french too, so that's why we continues to say "buffer" even when speaking french
You now see why I see sometimes the proposed translation sucks. Some words translates well some does not.
Quote:
Writing foreign language comments in BOM-less UTF-8 is probably the cleanest way to do so in programming languages that expect the program to be written in ASCII, and it appears common practice on UNIX.
But even on GNU/Linux, I have quite a unpleasent memories of a Python IDE being totally confused about line numbers when debugging due to just a few of my comments using Swedish characters, and thus needing multiple bytes with UTF encoding.
Usually I always write my comments in English though, and the above experience just gave me yet another (although pretty silly) reason to stick to this principle.
I thought everyone always wrote their docs in Japanese...
Actually, I'm a native English speaker, so I don't really have an answer to this question. Personally I appreciate the effort non-native speakers make to put comments, code, documentation, forum posts, etc. into English. But I don't feel that they have too. (On the other hand, it is easier to get help if you do...)
It's sad that Unicode support is still so badly implemented that many feel that they cannot use their native language, even if they want to. UTF-8 seems to be nearly universal on the web (when Unicode is used), but Windows (when it's not using ASCII or something) uses UTF-16. There are libraries to handle both (and many other encodings), such as one from IBM, but they don't seem to see much use.
I would be curious as to the level of Unicode support available in the various tools produced and used by the community.
Doesn't Notepad++ default to UTF-8 mode? Aside from the most obvious problem (opening a non UTF-8 file), how would you get any garbage characters if the file was originally created in Notepad++?
Then again, I have seen it fail to draw certain characters (like ①) if there are no other Unicode characters on the same line...
Also, from the Japanese code I've seen, code is often in English, comments are usually in Japanese. Sometimes variables are in English, often times they are in Romaji, and in languages that allow it, sometimes Kanji.
At least the MML replay engine is fully commented in Japanese... and that's not a good thing
Variable names are (mostly) in english though.
And does any language really accept Kanjis ?!!? I'd already by surprised if they accepted kanas. Well maybe kanjis can make their variables name shorter if they can replace words by a single kanji.
Most modern languages allow for non-ASCII characters only in comments and strings, not in identifiers. Older languages generally don't support character encodings larger than eight bits at all.
Theoretically, a language (or language extension) could use the character type information present in the Unicode database to be fully internationalizable or localizable, but I'm not aware of any that does. (Although I'd be really surprised if there's not at least a few.) A lighter weight solution would be to treat any character outside a specific reserved set as allowed in identifiers. This could create potential ambiguities with allowing punctuation and variant space characters in identifiers, but such could be prohibited by coding standards instead.
Actionscript allows Kanji.