Mortal coding sin: programming in your mother tongue - ISerializable - Roy Osherove's Blog

Mortal coding sin: programming in your mother tongue

If there's one nasty coding habit that gets me riled up every time it has to be coding with non English words. This probably won't mean much to the English speaking crowd, but here in Israel, and in other non English speaking countries, junior developers often choose to give their parameters, class names, database tables and sprocs names that, although written in English, are words in their mother tongue.
For example, I've come across code that looks like this:
 

Public Class MenahelLakoach

    Public Sub HosafatLachoach(ByVal shem As String, ByVal TeudatZehut As String)

        'Ugly code taken from original

        Dim sql As String = "insert into LAKOACH (shem,TeudatZehut) VALUES ('" + shem + "','" + TeudatZehut + "')"

        'more code here

    End Sub

End Class

 

Obviously, this is totally unreadable to anyone who does not speak Hebrew. Actually, it's hard to read even if you know Hebrew since you're used to read English, not translating it in your head to Hebrew. Ugh. Here's an easier to read translation:

 

 

 

Public Class CustomerManager

    Public Sub AddCustomer(ByVal Name As String, ByVal ID As String)

        'Ugly code taken from original

        Dim sql As String = "insert into CUSTOMERS (Name,ID) VALUES ('" + Name + "','" + ID + "')"

        'more code here

    End Sub

End Class

 

 

Not too hard, is it? Please, for the sake of the developer after you, write in English. Look at it this way:

  • Now you can actually send the code over to someone and they'll understand it no matter what their mother tongue is
  • it's more reusable
  • hey, you had to learn English to program , right? might as well use it.
  • You won't have to think so much about how to spell a particular non english word in english, thank god.
Published Thursday, February 05, 2004 2:01 PM by RoyOsherove
Filed under:

Comments

Thursday, February 05, 2004 12:54 AM by TrackBack

# A better obfuscating ?

Thursday, February 05, 2004 7:30 AM by Moshe Eshel

# re: Mortal coding sin: programming in your mother tongue

Hi,

You are soooo right, it is so hard for me to even understand some times what is written. The first time I encountered this was when my father (yes I'm a second generation coder :) showed me some code he wrote years ago.

It was written in awk (some UNIX script) and it was riddled with variables like Shura (for line), Mila (for word) and more.

Apparently this was more than just easy, it was a coding standard where he worked, that is what was defined for them to work. This is still common practice in companies using COBOL and such where the code base is very old.

personally I think it is cute, but I would never write that way.
Thursday, February 05, 2004 7:34 AM by Steven Livingstone

# re: Mortal coding sin: programming in your mother tongue

I've always thought it would be cool if keywords, variables etc could be in whatever language you wanted, with an external (or perhaps internal along with the Xml comments that already exist) mapping Xml. At design time (say in VS.Net) reads your chosen mapping.

An old Uni prof. was Italian and did a lot of stuff in Italian as you comment. I did Italian for a bit and speak some Spanish so sometimes stuff leaks in there - admittedly it DID confuse people in the physics department when they went to look at it later... especially as coding names are increasingly significant (along with doco of course!). Mapping would be cool for me, but does come with extra work - but there are a few who may like it. Maybe :)

Steven
Thursday, February 05, 2004 7:41 AM by Frans Bouma

# re: Mortal coding sin: programming in your mother tongue

There are problems though. Now, 'Customer' is understandable, but if you're writing an application which is just for your users using teh mother language you have to OR translate everything over (customer, order, invoice, inquiry, whatever) which can be quite a pain, OR you have to keep your mother language for these words.

This can lead to constructions like:
public void AddLakoach(...)
{
}

I'm not all for translating everything to English, it can make the code feel really alienated, especially in comments.
Thursday, February 05, 2004 7:52 AM by Stefan Koell

# re: Mortal coding sin: programming in your mother tongue

My suggestion: write code in Klingon ;-)
Thursday, February 05, 2004 7:59 AM by Micael Baerens

# re: Mortal coding sin: programming in your mother tongue

Could not agree more - I'm having to use a database with stored procedures named things like "GetBlanket" (Blanket is the danish word for form)...

It's driving me nuts!
Thursday, February 05, 2004 8:51 AM by Phil Scott

# re: Mortal coding sin: programming in your mother tongue

You know, I've always wondered what code writing entirely by people from another country that would be used in house would look like. I could see C# perhaps being OK to code like that, but VB is so verbose and english based it seems like your brain would have to switch back and forth between languages when typing.

We had an indian CS professor in college who when frustrated would start writing all kinds of garbledy-gook on the chalk board and start talking Hindi. It was pretty messed up.
Thursday, February 05, 2004 9:03 AM by Scott

# re: Mortal coding sin: programming in your mother tongue

Maybe the localization features of .NET could be extended member names as well? ;)
Thursday, February 05, 2004 10:06 AM by Darrell

# re: Mortal coding sin: programming in your mother tongue

Interesting. I know that English is the standard language for international flights, and now appears to be the de facto standard for programming.

What an interesting place this world would be if we all spoke the same language!
Thursday, February 05, 2004 10:34 AM by Daz

# re: Mortal coding sin: programming in your mother tongue

I'm a consultant in a french speaking region and i believe that the client who's paying the bill have the right to decide if we are to code in english or french! After all, he's the one that will have to maintain the application.

One thing is great about coding in another language than english, when i use .NET keyword, it's not conflictual.

Ex. : XmlReader is the type and would be my instance LecteurXml.

Still, if the choice is mine, i would go in english for the shorter names.


Thursday, February 05, 2004 11:17 AM by Xavi

# re: Mortal coding sin: programming in your mother tongue

<roy>
hey, you had to learn English to program , right? might as well use it.
</roy>
I disagree. I fail to see the need for programming in english, unless you know that the project will be somehow internationalized.
Maybe every programmer in Israel speak english; but here in Spain (I suspect in other countries too) you can easily find programmers with little or no knowledge of the english language, and programming in an unknown language is really a pain...
Thursday, February 05, 2004 11:44 AM by Omer van Kloeten

# re: Mortal coding sin: programming in your mother tongue

IMO, You're partially right.
Some of the entity types should remain in Hebrew, mostly because there is no direct translation. For instance, the word Toshav (citizen, civilian, resident, settler, ...) has no direct single word in English and is better off English-ized (ugh, what a word...).

Did you know you can program in the Hebrew alphabet? We're not telling our customers that or they'll want all the variable names in Hebrew... eww...
Thursday, February 05, 2004 12:23 PM by Mauricio Feijo

# re: Mortal coding sin: programming in your mother tongue

My experience coding and consulting in Brazil and Argentina is that :

1) All programmers read some English. They don't necessarily speak it, but do read some, otherwise, how can they code? All verbs ( commands) are in English. unless the language is assembler ( where the mnemonics are abbreviations of English words) or mumps ( where there are not many words, just letter, ( most initials of English words).

2) Comments, Names of variables, subroutines, classes, etc should be in English. I had to go back once and change all my comments, names and such from Portuguese to English because I sold the code to a store in Buenos Aires, and their developer could not understand Portuguese.

OK, it is possible to work with other languages. it is possible to maintain a code in Hebrew, for example, but it is a pain. So, Why?

The only case I think this is justifiable (?) is when someone is paying you to code in a specific tongue. then, my friend, whatever you say.. show me the money..
Thursday, February 05, 2004 1:03 PM by Xavi

# re: Mortal coding sin: programming in your mother tongue

Mauricio,
1) That's your experience, not mine. While I agree that most programmers have a rough understanding of english texts, I can think of a dozen of good programmers that can't figure out the purpose of a method just reading the name, they just read the explanation on the spanish MSDN library.

2) If you code can be sold in a foreign country, write it in English (by the way, native spanish speakers that can't read portuguese? Surprising!). But, if you are brazilian, and you are coding, let's say, a new portal for the brazilian public administration, there is no need to do it in english; most programmers in the project will read english more or less, but all of them will be, probably, native portuguese speakers so, what would be harder?
Thursday, February 05, 2004 5:35 PM by Roy Osherove

# re: Mortal coding sin: programming in your mother tongue

Granted, there are exceptions to every rule, but for the common stuff, unless you really really have to, stick to english. I think in the end you also make yourself as a developer more accessible to english materials. Its about personal progress as much as it is about a united coding standard that everyone can read. Make yourself do english even if it's hard. It will only get easier and you will be able to see the vast world of english material out there.
Thursday, February 05, 2004 6:04 PM by TrackBack

# Take Outs: The Digital Doggy Bag of Blog Bits for 5 February 2004

Sunday, February 08, 2004 6:45 PM by TrackBack

# Take Outs: The Digital Doggy Bag of Blog Bits for 6,7 and 8 February 2004

Doing things the hard way with RSS Bandit leads to some interesting statistics; Stuff for my Boss and co-workers; SOA and Joe Developer -- Phillip gets it right (again); Bits on Reporting Services; Wake up and smell RSS.NET; htmlArea (drool); InfoPath duh; McD's
Sunday, February 08, 2004 9:08 PM by Kirk Allen Evans

# re: Mortal coding sin: programming in your mother tongue

I actually like that challenge in newsgroups, when I answer posts where the poster uses variable names from another culture. It helps reinforce the concept that the variable name means absolutely nothing, it is only a convenience to the coder. At least, that helps me sleep at night, considering I continually bite my tongue when my clients insist on (inconsistently) using Hungarian conventions throughout their code. Die, "m_strCustName", die!
Monday, May 10, 2004 7:37 AM by TrackBack

# Programming

Now I am not a programmer and don't ever want to be a programmer, but I do know how to code and spend a decent amount of my time looking at code. I came across this about coding in your mother tongue and found it kinda amusing....
Friday, May 21, 2004 10:06 AM by DB

# Depends on circumstances

Function and variable names are a convenience to the coder. If your development team is X, it makes sense that they'll develop in Xese barring identifiers, libraries, and such. Whatever steps are necessary to make them more efficient. I would rather have clear Xese than strange, mis-translated English.

I don't think it's worth mandating that everyone code in a foreign language (English) just in case the code must be maintained by someone who does not speak the language. It is also an unprovable assumption that everyone speaks English. As another poster said, there are localized documents for just about everything.

This is nothing but the SUV mentality. "Well, I might need to haul something once or twice in the next 5 years, better get an SUV." "Well, someone who doesn't speak your language might look at your code, better make it English!"

Of course, if you are off-shoring your code, you better expect that the developers write in your language since, presumably, you are going to review their work. So, as the title says, it depends on the circumstances. Your code should be the best for the circumstance, not the best for every circumstance.