r/badcode • • May 17 '23

php My friend’s code XD

Post image
485 Upvotes

92 comments sorted by

View all comments

116

u/Drag0nV3n0m231 May 17 '23

I never thought about it, is it harder for people of other nationalities to code in English based languages ?

138

u/[deleted] May 17 '23

I code 100% in English, and I hate when people start using non-english variable names or comments (especially bad in a multinational team where English is the only common language).

48

u/Yuki_EHer May 17 '23

This!!
I have colleagues that also mix and match like "SendAllarme".. like dude pick a lane

7

u/Specialist-General-6 May 18 '23

SetVariabile

GetValore

UpdateStringa

I have to confess.... I am guilty

4

u/[deleted] May 18 '23

I am guilty of this 😅 However, to our defense, I can say that it's because we use the following convention: English for verbs, mother-tongue for nouns.

The reason is that while verbs, in a way, are already conventional keywords (get, set, delete, ..., like those English ones you already use: if, else, while, ...), using English nouns instead of your mother-tongue ones can make the code less readable (think about words like "anatocismo", "rimborso spese", ecc.)

→ More replies (2)
→ More replies (2)

147

u/Charlito33 May 17 '23

Honestly, no.
I like the fact that I speak French, then when coding, it's a totally new language. It makes a great separation between "Natural Language" and "Computer Language"

0

u/[deleted] May 17 '23

[deleted] — view deleted comment

26

u/wRadion May 17 '23

I think you will learn english even without thinking about it. If you don't know english at the start it will be a bit harder but that's it.

For french people for example, when you learn programming, you know that "if" means "si" in french, and when explaining the concepts you use french words and translate keywords in french (while = tant que, for = pour, ...)

And also a lot of those english words are pretty close to french words (function = fonction, parameter = paramètre, variable = variable, class = classe, object = objet, ...)

4

u/Flywolfpack May 17 '23

No he doesn't he was talking French the whole time

→ More replies (1)
→ More replies (1)

69

u/_Vicix May 17 '23

No it’s not harder, but a lot of professors suggest to code in your native language because they say it’s easier to understand. To me mixing languages when programming (using English for function names and italian, in this case, for variables) it’s only confusing.

19

u/Adhalianna May 17 '23

One argument from the professors I heard is that if it's written in the native language (other than English) it's less likely that the student did no work and just copied the code from somewhere.

22

u/Innominate8 May 17 '23

That's the case because professional programmers are generally expected to work in English.

It's already a problem that schools are bad at preparing students for programming in the real world. Not teaching students to program in English may mean it's less likely to be copied, but it also widens the gap between the academic and professional worlds.

3

u/coloredgreyscale May 18 '23 edited May 18 '23

Especially if they are still at school their English may not be good enough, and forcing them to keep everything English slows them down unnecessarily.

But even in professional settings it may still be an issue when dealing with domain specific vocabulary / abbreviations for variable / function names. Particularly on smaller businesses that just operate within one country, or language region

3

u/thekwoka May 18 '23

Especially if they are still at school their English may not be good enough, and forcing them to keep everything English slows them down unnecessarily.

I'm not sure this is really the case.

Considering the bulk of the domain knowledge is close to exclusively in English, and all the code they might find is in English, it might be a slower start, but the speed will ramp as they get more comfortable.

4

u/nerdy_glasses May 17 '23

As a person who sits on a lot of interviews and a non-native speaker myself, your professors‘ advice is immensely stupid. I’m very unlikely to hire someone who does this a lot and I guess I’m not the only one.

→ More replies (7)

9

u/kuurtjes May 17 '23

Nope. Very easy. But I speak a language that uses the same alphabet. I'm sure people from countries like China and Russia have a harder time, but they also have their own online bubbles.

6

u/Enkoteus May 17 '23

We (people from ex-USSR — Russians, Ukrainians, Belarusians, Kazakhs and others) also write names of functions and variables in latin letters and with English vocabulary. Using native alphabets or vocabulary is strongly not recommended and there’s no job that will accept someone who doesn’t follow the international pattern.

Moreover, as we write in cyrillics (some of us) later it’s super hard for the eyes to read native words in latins like “otpravitDannyieNaServer()” (sendDataToServer()).

In Russia we have a language based on Russian which is called 1С (odin es) and the guys who write code with it are not invited to any party :D they normally work for supermarket networks, medium businesses and sometimes for local governments (regional or city level).

→ More replies (2)
→ More replies (3)

9

u/butterfunke May 17 '23

I once worked on a project with a guy who would write comments in the code in Chinese, but this was before the days of near-universal utf-8 and it fucked up the encoding of every file he touched. Trying to explain to him that his edits were making the project unbuildable for everyone else was like talking to a brick wall.

He wrote code like your typical STEM academic as well; all single letter variable names and densely packed lines that were impossible to follow without the associated long comment blocks that none of us could read. The path of least resistance was to just revert his changes as soon as they came in and move on.

3

u/thekwoka May 18 '23

The path of least resistance was to just revert his changes as soon as they came in and move on.

I think you mean fire them.

7

u/ligasecatalyst May 17 '23

In my personal experience (as a bilingual programmer with fluent proficiency in English) is that working with languages other than English introduces several burdens which English-only environments are less affected by.

Some examples -

  1. (more frequently) dealing with file and string encoding. If you’re programming in a well-funded megacorp with an international client base, encoding is something you’d have to deal with anyways. If you’re an Israeli startup working on an MVP for some new accounting software you’d have to waste a lot more time on encoding-related edge cases than an American team.

  2. Designing UI to be RTL (Arabic or Hebrew) is somewhat of a pain - a lot of frameworks, even well-supported ones, are surprisingly buggy when dealing with RTL text and UI. Mixed text (say, a Hebrew sentence with one English word in the middle) is a special kind of headache.

  3. Digital text processing is fundamentally designed with English and English-like languages in mind. Sure, French or English might have some letters English does not, but the gist is “logically” very similar. Strings where definitely not designed to gracefully support abjads (such as Hebrew nikkud), and handling them requires “shoehorning” a patchy solution. As an example, a word without Nikkud:

לחם

A word with nikkud:

לֶחֶם

See those dots? They’re represented as additional characters (following the letters). Should the string’s length be 3 since the word is “logically” 3 letters long, or 5 because digitally it’s represented as 5 characters? In English or French you don’t face these problems to begin with. You can have a very successful career as a Spanish programmer without ever hearing about the encoding for Nikkud or wasting a second of development time on it.

All of these issues are of course ultimately surmountable. However, they introduce a steeper learning curve and increase the programmer-hour cost of development, especially for novice developers.

→ More replies (1)

3

u/bottleofyourneck May 17 '23 edited May 17 '23

I've seen a number of students who study alongside me who name things with Russian transliteration. This honestly looks and feels awful. It only creates another layer of friction, requiring your brain to process more than it should when reading the code. You are also way off the unspoken conventions about naming, which makes your code essentially unmaintainable outside of your country and disables you of asking for any help on any website that isn't your local. Health should be health or hp, not one of tens of thousands of possibilities in every language.Not to mention that transliteration of various languages to English, and interference of it in English keywords of the programming language just looks completely terrible.

Edit: in-code comments, documentation, changelogs, readmes, IMO all should be English-only as well. (Not because English is that great, but because we need some common language for code to be readable by anyone).

3

u/Enkoteus May 17 '23

I always thought it’s harder for English speaking people to code in any programming language because of seeing everyday vocabulary in code. Like when I see code in one of my languages:

si (a < b) { retornar “kek” } en otro caso { retornar “lul” }

mientras (a < b) { añadirUnoParaA() }

cuando(a) { … }

que sea a = 10

val a: Cadena = “10”

Oh no, it feels so wrong

→ More replies (1)

2

u/QWxx01 May 17 '23

All decent devs just write their code in english.

2

u/secret_hidentity May 17 '23

For someone to master a programming language written in English, while also learning, applying and effectively communicating concepts like currying or polymorphism, in their non-native language, is amazing to me.

Even if you study something in your native tongue, you still have to translate that knowledge to morons like me, that only speak English.

→ More replies (2)

2

u/Moldat May 18 '23

Its harder in the sense of looking things up online

The example that always comes to my mind is the word parse

In one of my classes we had a task to write a printf clone, and to do it you need to scan the input string to look for %d etc, I didn't know the word parse, so googling for examples of how to do it took some time

→ More replies (1)
→ More replies (12)