Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colour instead of color?

I'm working on a game engine in C++ and I have methods like setColour and things that use British grammar. While I was thinking how C++ compilers mostly use the English language (correct me if I'm wrong) and how most APIs use American grammar, should I go with the flow and continue the unofficial standard in the grammar programmer high council or be a rebel?

I'm not sure which.

like image 302
Jookia Avatar asked Mar 15 '10 01:03

Jookia


3 Answers

You should use the American spelling of color. 99% of code out there uses this, even including much of the code written by British or Australian English speakers. If you use something different, you (or someone else that uses your code) are just going to end up forgetting which to use at some point and making a needless mistake.

like image 111
Tobias Cohen Avatar answered Nov 09 '22 05:11

Tobias Cohen


I'm British, and I think the right thing to do is to grit my teeth and use Color. I wouldn't normally expect a German-speaking programmer to use Farbe in a public API[*] and I wouldn't expect to have to provide alternative spellings like finalize vs finalise or localization vs. localisation.

The compiler will point out any mistakes, so I think providing alternative names for things is misguided. Come to think of it, it could even hinder some programmers since IDE auto-completion will have more to chew on. If you're going to use a single spelling hten "Color" is such a common word in APIs, commonly spelled without the "u", that it's wilful idiosyncrasy to spell it any other way. It doesn't help anyone much.

Obviously there's no clinching argument - you can call your functions method001, method002 if you like, and the code will still work, so Colour is a minor quirk by comparison. But there's a fine line between "quirky" and "misanthropic".

[*] Just because he finds it more readable than Color, I mean. If he doesn't speak English at all, he has no choice.

like image 42
Steve Jessop Avatar answered Nov 09 '22 05:11

Steve Jessop


Be a rebel! Go with your native English.

If you feel like tossing a sop at the Americans, provide cover functions with the incorrect spelling (facetiously: but just make sure they run enough slower that they prefer to use the right spelling).

like image 44
Jonathan Leffler Avatar answered Nov 09 '22 07:11

Jonathan Leffler