DEV Community

Zohar Peled
Zohar Peled

Posted on

writing code: Native language or English only?

This question is obviously not for native English speakers - they don't have this problem.

It's addressed to all of us other developers which English is not our native language.

When you write code - do you use your native language for stuff like variable names, or strictly using English?

Personally, I use only English in code, but I've seen plenty of code examples where the variable are named in a language I don't recognize.

What do you prefer, and why?

Latest comments (4)

Collapse
 
fluffynuts profile image
Davyd McColl

I am a native english speaker, but perhaps my 2c is worth it:

There have been a couple of times that I've found repos on GitHub, usually through the ChangeLog nightly emails, that look hella interesting, but they're all in Chinese. So I give up.

All I'm trying to say is that, for better or worse, english is the lingua franca of this planet, so if you want the widest audience, try it. Your english doesn't have to be perfect either -- I can easily deal with english that's "good enough", but I can't read Chinese at all. I could probably deal with some level of Dutch (since I speak Afrikaans too, and can understand the general gist of Dutch text, mostly), but Russian? Any of the Nordic tongues? Greek? It's all Greek to me! :D

Collapse
 
peledzohar profile image
Zohar Peled

I've seen it a million times on Stackoverflow - where someone asks a question with variable names in German or Greek or whatever - IMHO, that just makes the code harder to read. My native language is Hebrew, so it uses a completely different set of letters than English, but I have to say I did see some code written in Hebrish (That's Hebrew words written in English letters. The horror!) back when I was more active in Hebrew based professional websites and forums.

Collapse
 
fluffynuts profile image
Davyd McColl

thing is -- I don't want to say "don't write in your native language". A lot of programming is the journey of translating human thoughts into something that a machine can execute. Different languages are different at expression -- sometimes it's way easier to express an idea in one language than in another. In addition, I really don't want people to think that their native tongue is trash! There's a lot to be learned from each language -- and english is far from "pure" too! Much of english is derived from Latin (Italian) or French! English really is a mongrel language!

But coming back to my original point: putting aside all the flaws of english and how valuable each spoken (and programming!) language is, the closer you come to something everyone understands, the more likely others will be able to adopt, adapt and share your work. If that's important to you, select english -- otherwise, make the conscious choice to program in your native tongue.

As an example, I have a friend who works with people on STALKER game stuff. Most of that is in Russian. When I've been asked to help, I've struggled, because I'm not Russian in the slightest (on the other hand, my friend has dived right in and learned, which is cool!). Russian is a barrier to me because there are so many places I can put my focus, where, for him, he loves STALKER and that's where his passion is, so he learned enough Russian to fit in. Could I learn enough? Sure! Do I want to? One hundred percent! Do I have the time to learn that and all the other stuff I have to learn just to stay remotely relevant? 😞 no 😞

It's the same in other areas of dev -- often I'm making tech choices based on how easy it would be for someone else to contribute to my project, if they wanted to. Since I could use any of the 20+ languages I'm happy with to write code, I often follow this selection process:

  • is there a language which makes the problem space easier (often: no, or at least: there are several candidates)
  • is there a language which would make it easier for someone else to understand and contribute? (often: yes, and often: C#, JavaScript or TypeScript -- no matter how much I like the others. Though I often pick TS/JS over Python, but they probably have about the same audience size, but my JS/TS > my python, no matter how much I <3 the py ); )
Thread Thread
 
peledzohar profile image
Zohar Peled

Don't get me wrong, I love Hebrew, and I'm not saying English is anywhere near pure or perfect, however I do think that even if it's just for the sake of being able to ask a question about your code in websites like SO and get an answer - write code in English.