views:

764

answers:

18

I am just working on a project where the library has an object with the property color, however being British I always use colour when writing variables and properties.

I also just found some legacy code where the British developer used color in a variable name.

Is American English the default for development now?

+15  A: 

I'm British and usually use the American in coding. This is because most mainstream libraries (eg C# Java) use the American standard, and so if your code matches this it is easier on everyone's mind.

Trying to remember whether I should use -ize or -ise always takes me a while though!

Eg: Java Color

Nick Fortescue
We have a standard? For language?
TokenMacGuy
I'm an American, and even I sometimes forget whether to use -ise or -ize.
notJim
+1  A: 

Yes, because there's got to be a standard, and most software comes from the US.

I bet you would like german variable names rather less, wouldn't you (I'm german)? Not to mention chinese, which technically could be used in Java.

starblue
"most software comes from the US" care to qualify that? I'm kinda skeptical these days
annakata
It's an example for a standard that's actively harmful when taken too far. You would NOT like a variable name "final maturity", when the same piece of data is called "Endfälligkeit" on the GUI and in the spec.
Michael Borgwardt
@Borgwardt Maybe, but then I actively avoid the kind of software where such names might occur and program embedded systems.
starblue
The better argument would be that most implementations of programming languages are using english keywords. So english variable names would fit better. On the other side: „falls(finalMaturity)“ would also sound strange.
Gumbo
+4  A: 

Though I am British I go into developer spelling mode as soon as I hit an IDE just because of having to use APIs which are invariably written in American English.

Therefore, any code I write will generally be in American English as well.

Garry Shutler
+5  A: 

My language is dutch, but I code in english. Just because it looks silly using dutch identifiers and english language keywords.

Comment is a different story. We have no non dutch speaking developers so the comments are mostly dutch.

Gamecat
He he, this reminds me that Blender used to have a lot of dutch identifiers, and some of them are still there, although the developers did a great job in "translating" the codebase after it went opensource.
UncleZeiv
So what happens when you're company grows and starts looking for developers worldwide or has to open another development site in Bangalore or gets bought by Microsoft ...
Markus Schnell
Its very unlikely, due to our type of business. We are not a software company and our shares are kept privately.
Gamecat
+2  A: 

British or American English, it doesn't matter för me, as long as I don't use Swedish.

There is always a chance that a foreign part will be involved, it would be extremely contra-productive to write code and comments in own language.

TFM
If it's software written by Swedish developers for Swedish users to a Swedish spec, then I believe it would be even more contra-productive to use English exclusively.
Michael Borgwardt
I don't agree. Spec can be in local language, it can always be translated easily. But translation the code, and every comment with it, is not a realistic option.Companies get bought, software consultants come and go. Software lives on.
TFM
Right, using your local language (unless it’s English, of course) will at some point come back and bite you in the ass. That can happen when your company suddenly decides to open source its project or just when someone who doesn’t speak your local language is employed .
Bombe
If you translate the spec (which is anything but easy to do properly), you're still fucked, because you'll now have some terms translated differently between the code and the spec.
Michael Borgwardt
And using English everywhere just because will bite you in the ass right now through constant productivity loss - and this hypothetical open-sourcing or developer who can't even read the spec or the GUI most likely never manifests. A bad case of YAGNI, if you ask me.
Michael Borgwardt
+9  A: 

Is it ok to use British English variables names? It seems to me you are saying the answer is (or should be) yes.

So, tell me please, is it ok to use Hindi variables names? How about variables my mother toungue, Gujarati?

I think we are better off using names (like road signs), that everyone can understand.

British English is probably ok going by that. But then, you should not use different spellings for the same word in a single codebase. So as not have colour and favor in the same codebase, it is better to settle on one or the other at start.

Just my two cents/pence/paisa...

Hemal Pandya
I think with non English coders it is fine to use variable names which are local to them (and their co workers). However with US vs British English I think that US should be used as standard to avoid confusion with standards.
Jeremy French
That would work only if the co-workers all had a single language local to all of them. English -- and today perhaps American English -- is the universal local language.
Hemal Pandya
+7  A: 

I will put up with 'color', but never with 'initialization'!

anon
First an Englishman, second a coder.
Chris Needham
Which is ammusing because British English accepts z or s in that word...American English only accepts z.
Jeff Yates
"I'm arbitrary in which rules I follow" doesn't strike me as a helpful answer.
Rob Kennedy
+1  A: 

No, only in English. It's become an industry standard. Especially, if it's not your private project you'll never know who comes to develop and maintain it after you. So stick with English. British or American doesn't matter.

User
+1  A: 

It really depends on the project. If it's not international in scope, then the friction of using English exclusively is much worse than the (purely hypothetical) problem of wanting to have developers who don't speak the native language of the other developers, the app's users (and thus its GUI), and its spec. Such a developer will not be able to contribute meaningfully, no matter whether the code is all in English or not.

My answer for a non-international app: use the native language for comments and domain terms, use English for technical stuff.

Michael Borgwardt
+1  A: 

Where I can I try and convert those around me to our Great British way of thinking by naming variables with British English. It also creates a great game whereby you see how long you can go with variables that are coded in British English and changing other peoples code so it's British English.

If I were writing client facing code I would probably code in British English through habit but I wouldn't be so tactless as to change interface design for such a thing.

PintSizedCat
+1  A: 

I'm bilingual (German + American English). The application I work on most of the time is pretty domain specific and that domain is talked about, documented and named in German.

The result is that we tend to use (American) English for technical terms and (Austrian) German for domain-specific terms. This can lead to variable names that are mix languages. This is ugly. However, the alternative of translating technical terms to German or domain terms to English would impede communication considerably.

Comments tend to be the same way: technical nitty-gritty in English; domain-specifics in German. Comments touching on both aspects tend to be German with English loan-words.

bendin
+2  A: 

I'm Finnish, but I write all my code in English. You can never know who will maintain your code after many years, so it's best to have the code and its documentation in a common language, and English is the industry standard language in programming.

In documents and UI prototypes that need to be shown to the users and clients, I might use Finnish, so that the users and clients would understand them better. But they don't need to see the code, so that should always be in English.

The only places where I've seen code written in Finnish is in elementary programming courses and books. And even there I think that it would be best to have everything in English, so that the new programmers will never get used to writing code in any other language. (And if they anyways decide to use Finnish, at least write it properly with letters Ä and Ö instead of A and O! At least Java supports all Unicode characters in method and variable names, so you can even write them with Chinese characters, if you so feel like.)

Esko Luontola
+1  A: 

I suppose that American English has become the de facto system for the IT community. However, being Indian, it is British English that comes naturally to me but I have learned not to be jarred each time I read the word "color" or "analyze", so much so that now I hardly notice it.

When naming variables, I always tend to use the British spelling because that is the spelling that comes instinctively to me!

That said, variable names matter to that audience who is going to be reading your code. Public members should however be in the accepted language. M$ designed the BCL with American spellings in mind (Are most Americans even aware that there is a British way of spelling these words?) I have also seen people posting code snippets in technical forums with German or Swedish variable names in the code (and it makes the code so much harder to understand). They are simply using what they are comfortable with and that should be the guideline (unless your organization specifies otherwise).

My 2p.

Cerebrus
+1  A: 

The answer is the same as with any coding style discussion, as long as you apply it consistently it doesn't matter.

"Consistently" may of course mean across all code you personally write or it may mean across your team/company, it depends on what is more applicable to your situation.

Despite this, as an Aussie it's even more of a grey (or should that be gray) area.

Ash
+1  A: 

American English is the Latin of Science, and German of Medicine. In otherwords a temporary standard, but one that might change oneday, just as these other two changed within the last Century for the most part. I might end my life Programming in Indonesian if that replaces American English within my lifetime. That ought be fun brain training :)

Robert Gould
+2  A: 

I'll use the default referenced for the programming language and/or community.

If I'm writing to the standard used by the existing code then searching for examples and passing on my examples becomes easier for all.

Cheesy
+3  A: 

The standard for coding on the Microsoft platform is, as documented in the book Framework Design Guidelines, American English.

Florian
+1  A: 

Using your native language in code can introduce a lot of confusion.

Suppose your framework has an Initializer class. If you need a subclass for initializing colors would you name it:

  • ColourInitialiser
  • ColourInitializer
  • ColorInitialiser
  • ColorInitializer

You have to struggle with the conflicting goals of respecting your locale conventions and the conventions of the existing code. And the boundaries are very hard to define.

With a non-English language it's even more difficult. Should a variable referring to a RadioButton be named "radioButton" or the locale equivalent. What about the use of get and set as accessor prefixes.

Naming things is definitively not easy.

Alexandre Jasmin