|
It's a question of "polite code".
The options list in this question is just a list of "bad behavior" a dev should avoid.
Code must be readable, well documented where necessary, but not "documented because every method must have a comment block on top".
A method should fit on the screen. Not 5k, not even 1k, in best case not more than 50 lines of code in a single method. You can split that if think about it.
SOLID. A class (and each method) is responsible for ONE thing, not more, not less.
Polite code. Others shall have a chance to understand what's going on.
Readable, not crazy abbreviated method and member names ("customerID", not "cid"). No lone wolf code. Code for the swarm, for the herd.
Oh, and very important: Code must be ENGLISH. I don't want to see spanish or german or any other language in comments when looking up something at stack overflow. I speak german. I live in Austria, but coding is an english thing. Programming languages are "english". No need to force your brain into perma-translate mode between class/method names and the language syntax. I costs so much energy.
Well designed classes and methods allow us to write "kind of" english sentences when writing code.
if (customer.isLoggedIn()) logoutButton.setVisible(true); is easier to understand and read than
if (kunde.eingeloggt()) abmeldenKnopf.setVisible(true);
A dev gets tired 3 times faster if he/she is forced to "switch" languages all the time when reading/writing code. Think english when writing code. No matter what your native language is.
my 2 cent.
Cheers!
modified 28-Jun-21 0:41am.
|
|
|
|
|
Mike Barthold wrote: Programming languages are "english".
Do you also enjoy functions named "DataEdit" - because, after all, it's "Daten bearbeiten" in German...
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
tbh, for my understanding "dataEdit" is in no way a valid function name.
I can't even imagine what the function is supposed to do. but "updateRecordInDatabase" *is* a valid function name and tells me anything I need to know.
If it's in some kind of a data class, say "CustomerData", then the method should be named "edit" or just "update", so you get good readable code, like "customerData.update()", which, again, tells you everything you need to know. That's polite code.
|
|
|
|
|
Mike Barthold wrote: Oh, and very important: Code must be ENGLISH. I used to agree with you, but translating almost every specialized and/or made up jargon word my Dutch customers throw at me gets really tiring too.
At one point in my career I translated "mestland" to manure country.
I knew it wasn't correct, but at that moment I couldn't find what it was supposed to be and I was in a hurry to ship.
Turned out to be fattening country.
"Mest" can be both manure and fattening in Dutch, so that's how.
Also, when a customer calls me and says "I got a problem with mestland!" I don't want to think "mestland... how would I have translated that?"
Even worse when you're in a team and you have to think "how would my coworker have translated that?"
Became a real problem with a customer in the past.
You could keep a list with words and translations, but that would only add more work and still make communication to the customer more difficult.
So since then I'm just using whatever the customer is using.
|
|
|
|
|
Hi Sander,
I am not sure, whether we are talking about the same type of translation here... "mestland" sounds to me like a word the user sees on screen while using the application. That's not what I meant.
I meant classes, methods, members should be named in english. The user shall see everything in his/her language (or the desired language)
|
|
|
|
|
Yeah, I know what you meant.
Our users saw "mestland", of course.
But our software and database were full of "ManureCountry" (as DB column, property, variable, etc.) because no one knew the exact translation, so we want for a literal translation.
Our customer only wanted Dutch software, so they didn't give us translations and we really only did it for ourselves.
That software probably uses both FatteningCountry and ManureCountry now, as they found the correct translation later.
My current software looks a bit weird, with stuff like "GetMestland" or "UpdateMestland" (well, I'm not dealing with mestland anymore, but you get the gist).
It's half Dutch, half English, because as you said, programming languages and terms are English.
GetMestland sure as hell beats GetManureCountry though.
And if a customer calls me about mestland I immediately know what they're talking about.
I totally get why you'd do everything in English (easier to find (offshore) programmers too), but I've switched to the language of my customers.
That said, I still have Controllers, Views and Factories, and not Controleurs (or perhaps Opzichters?), Uitzichten/Aanblikken(I genuinely have no idea how to translate this, even with Google Translate) and Fabrieken, that would be weird
This is probably an issue for every non-English team with non-English customers: Ubiquitous Language in a non-english domain — webfactory GmbH[^]
But as an Austrian you've probably had this discussion too in the past
To all English speakers reading this, you're lucky your language was chosen as the #1 language in the world that all others should adjust to!
|
|
|
|
|
|
As a native English-speaking developer, this conversation has been a fascinating insight into the world of non-native English-speaking developers! Thank you both. It also makes me grateful that I don't have to think about those kind of complexities, and gives me a new-found respect for the additional challengers you face.
I can't even imagine what it must be like for developers who don't even speak English as a second language.
PS I now have a little bit of umlaut envy
|
|
|
|
|
If one does not speak English, at least on software coding level, in Poland, s/he doesn't get far in this field. After all, most docs are in English, most tutorials are in English, most recent books are in English, and almost every professional is publishing in English first.
|
|
|
|
|
Quote: PS I now have a little bit of umlaut envy
|
|
|
|
|
You Europeans (and European-descended) have it so easy!
Your languages are mostly descended from the same sources - Latin etc'.
What about us Right-to-Left Language users?
Having to translate to and from Hebrew is nearly 15% of my job...
Also, sometimes using readable variables and object names in this environment means naming them using a mash-up like "MenuSfiraMlay" for example, which translates to "StockTakingMenu".
The original developer here knew enough English to code, not enough to translate.
Which means that most related object use the same naming convention, to keep consistency and readability.
Also, sometimes I feel that some meanings are better expressed in Hebrew, especially when considering that future maintainers of this codebase will also be Native Hebrew speakers, with English sometimes being their third (!) language...
And I don't even want to think what it's like for Far-Eastern Language speakers..
|
|
|
|
|
Mike Barthold wrote: A dev gets tired 3 times faster if he/she is forced to "switch" languages all the time when reading/writing code. Think english when writing code. No matter what your native language is.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|