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?
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...
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?
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.
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
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 " ...
__________________ Vladdy | KL "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"
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.
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)
__________________
Don't resist to assimilation. Billions of Borgs can't be wrong!
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...
__________________
Former ASP Forum Moderator - I'm back!
If you can teach yourself how to learn, you can learn anything. ;)