View Full Version : Always code in English?

02-26-2003, 06:25 PM
I've run into this several times over the months, and just did again a little bit ago. I think most of us agree that functions and variable names should be, for the most part, semantically accurate towards what they represent or are being used for.

As far as I'm concerned, I think it's equally important that variables and function names be in english as well. Not only because the ECMA script vocabulary is english (which is the most important point) but also because when someone comes here looking for help and their code is in spanish or something, it easily takes me 2-3 times longer to figure out the problem.

What do you think? Should javascript code always be written in english?

02-26-2003, 06:39 PM
Esperanto. All the way. :cool:

02-26-2003, 06:41 PM
I don't say English is the most important language and it's not my mother-tongue however, for programming and business please stick to one language: ENGLISH...


02-26-2003, 07:35 PM
Better English than Chinese, Japanese, Greek, Arabian...

A foreigner survivor...

02-26-2003, 08:07 PM
i think good coding practice is more important. brace style and such. generally, based on the code itself, you can figure out what it's doing. how many functions has anyone seen, where the variable and function names made enough of a difference, that you couldn't have figured it out anyway?

02-26-2003, 09:13 PM
joh6nn, I see a great difference between method names like getElementById() and gtElmBI(), or even xyz123_2(). IMO the first choice is the most readable, and I always take the time to name variables, classes and methods in such a way that describes their purpose in a good way. I even refactor my objects sometimes only to change method names.

Back to topic: I always code in english, and in the company I work it's convention to do so. I think it makes a lot of sense because all programming terms and languages are in english anyway, and mixing languages leads IMO only to confusion.

Comments may be written in native language. It's often easier and faster to describe a process if you don't have to translate it, but if I have the time, I try to write them in english. Maybe someday I get so used to it that commenting in english is done much more fluently than I do now.

02-26-2003, 09:13 PM
I started doing some PHP development in this CMS/development framework application, and with their manual they published a coding standard. I never gave much thought to certain things, but since I've read it, I agree with them so much I've completely adopted it for PHP, and Javascript as well.

P.S. Part of their standard was to use english names for everything, and they live in Norway ;)

02-26-2003, 09:57 PM
I think it should be done in dutch :D

I agree with you, Beetle
I always try to translate my functions (I also forget to translate half of it, but hey, nobody is perfect ;))

02-26-2003, 10:03 PM
Sanskrit! We musn't forget Sanskrit!


02-26-2003, 11:56 PM
Even though English is not my native language, I 100% agree that coding should be done in English only.
My problem however, is having patience to spell out the variable names. Another day I needed to name an array of title strings and being on "autopilot" typed:
tits = new Array();
Fourtunately, my girlfriend, peeked over my shoulder and asked: "What kind of site are you working on:confused: " :D :D :D ...

02-27-2003, 12:03 AM
Originally posted by Vladdy
Another day I needed to name an array of title strings and being on "autopilot" typed:
tits = new Array();LOL :p

02-27-2003, 12:28 AM
Only 18 votes? ptbhhbhbbhb, I thought dozens of people came here daily....

02-27-2003, 12:37 AM
So what? 18 are one and half a dozen. :D

While we are at languages, let me just say that coding in Hungarian Notation is definitely *not* coding in english - so stay away from that practice. Just adds to obscurity of your code.

02-27-2003, 01:46 AM
If I create a new function or a new variable, I do it in my language; after all, I am who is using it!
However, if I have a problem and/or have to show my code to a non Spanish/Catalan person, I try to translate it for that person (but I still use the right version)

02-27-2003, 02:19 AM
Well, it seems that nearly 100% of the programmers here (if you don't count Borgtex) that don't use English as their "mother" or native language agree... it should be in English.

I can't argue with that.

P.S. I have never had a problem understanding Borgtex's code, and he seems to have no problem understanding code in English, so I guess that's a moot point. ;)

P.P.S. As far as I understand hungarian notation, is it not just camelCasing ?!?

From a quick search of some very confused programmers websites, that seems to be the case...

02-27-2003, 02:29 AM
Although, this seems to be an interesting take on the whole matter:


Look at the last post...

02-27-2003, 02:44 AM
Try this on for size, whammy

All Hungarian Notation is camelCasing
All camelCasing is not Hungarian Notation

Hungarian notation implements camelCasing but has an important distinction: it prefixes the variable name with a lowecase abbreviation of the variable type. examples:

sNote = "Get groceries"; // String
iAge = 24; // Integer
fPrice = 9.99; // Float
bToggle = true; // Boolean
oNode = document.body; // Object
arrData = new Array(); // Array
function fnDoIt() {}; // Function
fpHandler = clickHandler; // Function Pointer

Many of the code examples at MSDN use Hungarian Notation in this manner. The best reason I've heard to not use HN is because it's basically a form of commenting tied to the logic of the code. Anytime you make a change (from integer to float, or whatever) your 'commenting' via HN must also change to properly serve itself. What a waste.

02-27-2003, 02:48 AM
Well then forget it, it probably IS a bad idea. I still like sticking to whatever standards are appropriate, though...

but Hungarian notation (camelCasing) only has one specific place in .NET, apparently Microsoft realized its place as well.

I think the guy had a good idea... he was trying to create a standard to simplify things. But it's way too far gone for that!...

02-27-2003, 03:11 AM
Up until this thread, I've never really considered the possibility of JavaScript being coded in another language, or even that it's possible. Going completely off on a tangent here, I think Western Civilization owes a lot of its success to its alphabet based language system. English is far more intuitive, expressive, and easier to be articulate IMO than non alphabet based languages such as Chinese or Japanese. The human brain is much better at permutating than memorizing; English as a language is based on permutation, while Chinese for example memorization. Language affects thoughts, and hence the differences in advancements as far as technology/society etc. But enough on my future thesis paper :)

02-27-2003, 03:34 AM
I think the Hungarian Notation works well for the MSDN examples, because they never change. It can help readers that can't follow code as well as you or I. Of course, that presupposes that they understand the prefixes in the first place, which is unlikely.

Ya, HN == Bad Idea™

02-27-2003, 04:45 AM
Originally posted by mordred
joh6nn, I see a great difference between method names like getElementById() and gtElmBI(), or even xyz123_2(). IMO the first choice is the most readable, and I always take the time to name variables, classes and methods in such a way that describes their purpose in a good way.

i thought we were talking about naming variables in one language as opposed to another. if we're talking about that, then i don't think it matters which language you use.

if we're talking about naming things in ways that make absolutely no sense whatsoever, the no, don't do that.

02-27-2003, 04:53 AM
joh6nn, I'm curious as to why you don't think the language matters. As far as I'm concerned, the semantics of a function/variable name extend into the language used.

Javascript's vocabulary is in English. It only seems right to me that any extended vocabulary we create through our own functions/methods/properties, etc, ought be in English as well.

02-27-2003, 06:09 AM
if you speak English, sure, that makes sense. but if you don't speak English, and/or you don't have international concerns, then English doesn't make as much sense. I can understand if Mordred's company wants to code in English, if they expect that they might sell the code, or that international partners may use it. but my german friends name their variables in german, because they're not selling the code, they don't have to worry about people who don't speak german reading their code, and because naming things in one's native language improves readability.

moreover, if you require that everyone who codes speak English ( even if only well enough to name variables ) then you exclude a lot of people, who might otherwise write really nifty stuff.

02-27-2003, 07:39 AM
Whoa, hey now, I'm not requiring or imposing or even suggesting that anything like that needs to take place. I'm just curious as to what level non-english speaking people understand the english vocabulary they use with javascript.

02-27-2003, 08:05 AM
but, that is what you said, i thought. either that or i've completely misunderstood all of this.

Originally posted by beetle
As far as I'm concerned, I think it's equally important that variables and function names be in english as well.

Originally posted by beetle
What do you think? Should javascript code always be written in english?

02-27-2003, 12:24 PM
Of course everyone has to decide this issue for himself, and if you're coding for your own or just trying out something, do it as you like, whether you code in french, german or suaheli.

A problem I have with variable/method names is that there's always a point coming where you decide to mix languages. Imagine a class which has some getter/setter methods, like


Now if you want to keep the "get" prefix but continue coding in german, your methods would be named


Here's an additional problem: Because "size" translates to "Größe", you start replacing special characters. Now you could do that completely in german, and you'd have


Even for german native speakers it would be difficult to figure out the purpose of these methods because they look and feel very uncommon. Furthermore, you could have translated the "get" prefix in a couple of ways:


There is no direct and unambigious (sp?) translation of "get" into german, so you're basically inventing your own naming scheme here. Which is certainly ok if only you deal with that code, but once you share it... not only in commercial situations, think of open-source (german: "offene Quellen") projects.

I don't see the problem with the english language used in programming. It's more a technical jargon and you're constantly seeing it applied everywhere else, so I found it quite easy to adopt that jargon.

02-27-2003, 02:56 PM
I said: stick to ENGLISH...

However, is structure not more important?


02-27-2003, 05:58 PM
I like to have fun with my variable names. Like:

var itsOkay = true;

Purely so that I can go

if (itsOkay) {

Keeps me amused :D

Once I had to deal with a long, complicated script that was all in german. It was tricky at first, but only at first; I got used to it after a while; but even then the difficulty was only because I don't speak German.

I don't know - if you work always in a non-english language, but the programming language you use has English keywords, are you constantly and consciously aware of this, or do you not think about it after a while - like "getElementById" ceases to be a conceptually-english word, and becomes a conceptually-german word?

You know, like how we use words like "naive" - which is a French word - but I don't think of it like that; as far as my everyday useage is concerned, "naive" is an english word.

Anyway ... programming languages aren't written in English .. they're written in American. Last week a guy at work (not a web coder, but he dabbles because he administers web surveys) was trying to make a grey table cell:

<td background="grey">

And of course it wasn't. How long do you reckon before he realised :rolleyes:

02-27-2003, 06:05 PM
Hehe, I can relate to that 'American' thing. Check this php out...

$ref = $_SERVER['HTTP_REFERER']; // Valid

$ref = $_SERVER['HTTP_REFERRER']; // Invalid


referer (http://dictionary.reference.com/search?q=referer) - incorrect

referrer (http://dictionary.reference.com/search?q=referrer) - correct

It's not PHP, per se, but HTTP that has the typo :rolleyes:

02-27-2003, 07:05 PM
There's something about clean code that makes it so much more enjoyable to read - not to speak of debugging, modifying, rewriting or extending.

Writing clean code has several aspects - consistency, readability and flow (and, obviously, conforming to the rules of the programming language).
A consistent use of functions and terminology, names etc. makes code much nicer. Even if the names would never make sense if you didn't know the convention, consistency makes code understandable.
Readability is of course about indenting, putting newlines where they should be, and trying to write simple instead of complex statements. Also important here, is using comments where appropriate and names that makes sense, and that has something to do with what language you write them in.
Flow has more with format to do than anything else. Programmers from the C branch of programming languages tend to cram as much as possibly into each line - that disrupts the flow. On the other hand, those same programmers can be quite good at keeping blocks, brackets, parenteses, closures etc. where they should be, making the code flow better. But, flow also has to do with the reading - if you have to go back and check what a variable name really means, or get confused about overly nested statements and blocks, flow is also disrupted. This includes switching languages. Now, most people that know two or more languages fluidly or nearly so, will have to switch how they think when they switch from one language to another. That puts a halt in the flow. So, if you use variable, object and function names in languages other than English, that will be a disruption in thair reading.

Sometimes flow and readability really stands against eachother, but mostly they work together. Because of that , I think keeping to the same language is the way to go. Since most programming languages are based on English, that's what language is best suited for the naming of functions and variables.

// liorean <http://members.evolt.org/liorean/>

02-28-2003, 10:38 AM
Standards need to be maintained and since JavaScript first announced itself in English for better or worse it should remain English.

02-28-2003, 03:39 PM
/me says we should all program 'n Justamese. Then it would just a make® more sense.



02-28-2003, 04:15 PM
Originally posted by Spookster
/me says we should all program 'n Justamese. Then it would just a make® more sense.


justAAlert®(); LOL :D

02-28-2003, 04:28 PM
Originally posted by Spookster
/me says we should all program 'n Justamese. Then it would just a make® more sense.

just a lol... /me justtt a has® to a gree... Justamese it's the future
/me is just a sorrrrry® forrrr orthogra®phic mistak's... still a learning