The Only Universal Language In Software Is English

0 comments suggest edit

In a recent post, I compared the expressiveness of the Ruby style of writing code to the current C# style of writing code. I then went on and demonstrated one approach to achieving something close to Ruby’s expressiveness using Extension Methods in C# 3.0.

The discussion focused on how well each code sample expresses the intent of the author. Let’s look at the comparison:





C# 3.0 using Extension Methods:


It seems obvious to me that the C# 3.0 example is more expressive than the classic C# approach, but not everyone agrees. Several people have said something to the effect of:

Yeah, that’s great for those who speak English.

Another person mentioned that the Ruby style of code panders to English speakers? Really?! Really?!

Yet somehow, the classic C# example doesn’t pander to English speakers? In the Ruby example, I count 2 words in English, Minutes and Ago. In the classic C# example, I count 8 words in English-Date, Time, Now, Subtract, Time, Span, From, Minutes(decomposing the class names into their constituent words via Pascal Casing rules).

Not to mention that all of these code samples flow left-to-right, unlike languages such as Hebrew and Arabic which flow right to left.

Seems to me that if anything, the classic C# example panders just as much if not more to the English speaking world than the Ruby example.

One explanation given for this statement is the following:

DateTime.Now.Subtract(TimeSpan.FromMinutes(20)); follows a common convention across languages, a hierarchical OOP syntax that makes sense regardless of your native tongue

I don’t get it. How is 20.minutes.ago not hierarchical and object oriented yet we wouldn’t even take a second look at DateTime.Now.Day or 20.ToString(), both of which are currently in C# and familiar to developers.

The key goal in object oriented software is to attempt to develop abstractions and work with in the domain of those abstractions. That’s the foundation of OO. Working with a Product object and a Customer object rather than a large set of procedural methods makes it even possible to understand a large system.

Let’s look at a typical object oriented code sample found in an OO tutorial:

Customer customer = Load<Customer>(id);
Order order = customer.GetLastOrder();
ShippingProvider shipper = Shipping.Create();

I know I know! This code panders to English! Look at the way it’s written! GetLastOrder()? Shouldn’t that be ConseguirOrdenPasada()?

Keep in mind that this all stems from a discussion about Ruby, a language written by Yukihiro Matsumoto, a Japanese computer scientist.

Now why would a Japanese programmer write a programming language that “panders to English?”

Maybe because the only language in software that is universal is English. It’s just not possible to write a programming language that would be universally expressive in any human language. What might work for a Spanish speaker might be confusing to a Swahili speaker. Not to mention the difficulty in writing a programming language that would read left to right and right to left (Palindrome# anyone?).

Yet we must find common ground for a programming language, so choosing a human language we must. For historical reasons, English is that de-facto language. It’s the reason why all the major programming languages have English keywords and English words for its class libraries. It’s why you use the Color class in C# and not the Colour or 색깔 class.

Now I’m not some America-centrist who says this is the way it should be. I’m just saying this is the way it is. Feel free to create a programming language with all its major keywords in another language and see how widely it is adopted. It’s a fact of life. If you’re going to write software, you better learn some degree of English.

In conclusion, yes, 20.minutes.ago does pander to English, but only because all major programming languages pander to English. C# is no exception. In fact, pandering to English is our goal when trying to write readable software.

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.



43 responses

  1. Avatar for Josh
    Josh May 28th, 2007

    I think the commenters point is that "20.minutes.ago" *looks* like English (as a clause), while "DateTime.Now..." *looks* like our standard idea of how object oriented code flows, regardless of language.
    Personally "20.minutes.ago" seems odd to me, but I haven't jumped onto Ruby quite yet either ;)

  2. Avatar for Chris
    Chris May 28th, 2007

    "It’s the reason why all the major programming languages have English keywords and English words for its class libraries. It’s why you use the Color class in C# and not the Colour or 색깔 class."
    'Colour' is the English way, 'Color' is the American way :)

  3. Avatar for BarryD
    BarryD May 28th, 2007

    Well partly it's the market; most code languages came out of the US and catered to their market, and the UK/Europe where most developers have some grasp of English.
    I've always found it rather strange when I've used software where the variable names are in another language, but the object and method signatures are in English. Ultimate blackboxing I guess :)

  4. Avatar for Jeff Atwood
    Jeff Atwood May 28th, 2007

    No, the only universal language is American.

  5. Avatar for Haacked
    Haacked May 28th, 2007

    @Chris - I actually meant to make the point that Jeff Atwood just made. The universal language of code is not English. It's American English. Hence the Colour point.

  6. Avatar for Martin
    Martin May 28th, 2007

    There are a few exceptions to US English:

    Analyzes a plain text string.

    Documented in American, but the API name is British English.
    (To be honest, the differences between British and US English are tiny- in programming, it's just a few minor spelling differences of which colo[u]r and cent[er|re] are the main ones).

  7. Avatar for BarryD
    BarryD May 28th, 2007

    How interesting, someone at work just sent me documentation on a new language. And it's not English.
    You have to love that if/else construct :)

  8. Avatar for Jon Limjap
    Jon Limjap May 28th, 2007

    American English? Don't you guys mean en-US? :P

  9. Avatar for J. Irvine
    J. Irvine May 28th, 2007

    As the one who started the whole "English" thing, I guess I should respond. I agree with your assertion that the ".Ago" syntax is both simpler to read and understand - that was not really my point. The point is that the existing syntax, regardless of being "harder", is standardized. Language just makes it easy to illustrate. Custom operations implemented using Extension Methods need to be carefully designed or the result will be confusion.

  10. Avatar for Courtney V. Bearse
    Courtney V. Bearse May 28th, 2007

    Isn't this just about the semantics of a language. What do you call the sugar-laced, food-colored, carbonated beverage: soda? pop? Coke? soft-drink?
    In C# I would use DateTime.Now.AddMinutes(-20); instead of the previous examples. This would accomplish the same task, but it doesn't do it with much meaning.

  11. Avatar for Haacked
    Haacked May 28th, 2007

    @J. Irvine. - "Standardized?" So you mean to tell me that you never write custom classes and custom methods in your code, sticking only with the "standard" classes and methods that already exist?
    Have you ever written a "Helper" method used to wrap an ugly piece of code in a more readable manner?
    There's nothing "Standard" about DateTime.Now.AddMinutes(-20); It only just happens to already be a class and method that exists in the BCL. That doesn't mean we should never write more readable code that wraps that code.

    Custom operations implemented using Extension Methods need to be carefully designed or the result will be confusion.

    Agreed. But the same goes for abstract interfaces, methods, classes, etc...

  12. Avatar for Cam Soper
    Cam Soper May 28th, 2007

    I'm the only commenter on the previous post who used the word "panders," so I'm wondering if I'm the unnamed commenter you're referring to. Let's look at my original quote:

    I think what J.Irvine was implying is that DateTime.Now.Subtract(TimeSpan.FromMinutes(20)); follows a common convention across languages, a hierarchical OOP syntax that makes sense regardless of your native tongue, while 20.minutes.ago seems to pander to the English speaker, the English syntax; e.g., the adjective "ago" applying to "minutes." I'm not saying I agree, but I think that's what he was saying.

    Okay, so I was trying to clarify what I thought J.Irvine was saying. That interpretation being that the syntax of Ruby appears (to J.Irvine) to be the syntax of English. Whereas the syntax 20.minutes.ago is purely English, DateTime.Now.Subtract(TimeSpan.FromMinutes(20)) is the OOP syntax we know and love from Java and C#. Unfortunately, he never came back to tell us if my interpretation was correct.
    The preceding was my interpretation of what that other guy was saying. I do not fully agree. I'm sure there's something in there that I, the Ruby neophyte, am not grasping at this point, and if I took some time to play with it, I'd probably be able to explain why J.Irvine is incorrect.
    Now, in my own humble opinion, I'm not entirely sold on Ruby. I don't feel it solves any problem for me that C# doesn't already. Using LaptopHeaven's example, DateTime.Now.AddMinutes(-20) is just as (if not more) expressive to me as 20.minutes.ago. Scott Hanselman points to the beauty of Ruby as a language, but I just don't see it. Beauty is in the eye of the beholder, and I personally appreciate the beauty of C# and PowerShell. Doesn't mean I won't sharpen the saw (as Scott puts it), but I don't know that I'll be developing live applications in Ruby any time soon.

  13. Avatar for Cam Soper
    Cam Soper May 28th, 2007

    Hey, J.Irvine came back to speak for himself. I suppose it would help if I thoroughly read the other comments first.
    Strike my comments before "Now, in my own humble opinion..." :)

  14. Avatar for David O'Hara
    David O'Hara May 28th, 2007

    Raise your hand if you Googled "Palindrome#" in hopes of finding your next language??

  15. Avatar for Scott
    Scott May 28th, 2007

    Warning, blatant links!!
    I asked why all programming languages
    Also, why when non-english speakers are writing programs they often use english variable names. I can understand being forced by the language to use English keywords, but why name a "People" variable "People" instead of "Dineh"
    Got a few enlightening comments on each post.

  16. Avatar for Scott
    Scott May 28th, 2007

    me talk pretty one day.

  17. Avatar for J. Irvine
    J. Irvine May 28th, 2007

    Upon further reflection, perhaps I am overly concerned about the impact of extensions. My thinking is definitely colored by the utter terror I feel when pondering how some of my co-workers would use this feature. :-)

  18. Avatar for Haacked
    Haacked May 28th, 2007

    @Scott - My comments allow anchor tags dude. Use them! ;)

  19. Avatar for Haacked
    Haacked May 28th, 2007

    @J. Irvine - A reasonable terror. ;) However, if you fear your coworker's use of Extension Methods, aren't you also in fear of their use of ...say...code in general? ;)
    Maybe it's time to hide their keyboard. I think the issue of abusing extension methods is definitely a worthwhile topic. I actually find Extension methods to be easier to understand in one respect than typical interface inheritance.
    public void DoSomething(ISomeInterface blah)

    When reading this code, what does Foo() do? You can use Resharper to find all classes that implement ISomeInterface and get a sense of the range of possibilities.
    Now suppose you're reading code and you see
    Since this is using extension methods, you right click on Ago and find reference and it takes you directly to the implementation. Ah! This method returns a DateTime. What does Minutes() return? Right click, go to definition, boom! You are directly at the implementation.
    I think the real fear of abuse is that when I type "20.", Intellisense presents a list of 500 methods. ;)

  20. Avatar for Scott
    Scott May 28th, 2007

    Hmmmm, can you write a test for "Minutes" and "Ago"? How should they fail? Substitute "Years", "Seasons", or the bonus round "Quarters" for "Minutes". ;)

  21. Avatar for Karthik
    Karthik May 29th, 2007

    Interesting...this is first time I'm hearing of Ruby, a language developed by a Japanese guy, of "pandering" to English Language speakers.

  22. Avatar for Eber Irigoyen
    Eber Irigoyen May 29th, 2007

    you made the C# version purposely complex
    why not use

  23. Avatar for Rob Conery
    Rob Conery May 29th, 2007

    When I was at MIX this year I asked Miguel de Icaza if he sometimes coded in Spanish. He smiled and said he "used to" but never any more since English IS NOT the Universal Programming Language, it's The Universal Language in the same way that Latin was when that Other Empire ran the globe.
    The Brits started it, so don't get mad at us Yanks :).
    I think the cart's before the horse here when thinking about Ruby. The joy of Ruby is because it's syntax is so damn clean, and it's clean, in part, because you write as you think - there is no translation from the thought "hmmm, now what's the syntax again for 20 minutes ago?"
    A great example of Ruby's power (stolen from Why's Poignant Guide To Ruby) is this gem. Read it aloud to yourself if you can't tell what it does:
    require 'net/http'
    Net::HTTP.start( '', 80 ) do |http|
    print( http.get( '/en/LICENSE.txt' ).body )

  24. Avatar for Haacked
    Haacked May 29th, 2007

    @Eber - I didn't choose that C# example. It was given to me in the comments of my previous post.

  25. Avatar for BarryD
    BarryD May 29th, 2007

    Oh hold on Rob we've already had one language based on having it readable by non-technical people (and yes you can get COBOL for .net
    I'm not convinced that having something read as English is more productive for seasoned developers; for beginners perhaps, but we get used to our language constructs; it's part of what makes you a good developer.

  26. Avatar for Scott
    Scott May 29th, 2007

    "but we get used to our language constructs; it's part of what makes you a good developer."
    At first, you have to chain the elephant to a heavy stake driven deep into the ground using a thick chain. Eventually, the elephant learns that they can't pull the stake out of the ground or break the chain so they stop trying. Then you can substitute a rope for the chain. Eventually the elephant becomes used to the sensation of the rope around it's foot and thinks that it is stuck. At that point, you don't even have to drive the stake into the ground. Just tie the rope around the elephants foot and it will stay put.

  27. Avatar for Kevin Isom
    Kevin Isom May 29th, 2007

    One thing to consider is that if you aren't a native english speaker you don't speak or even think in the same manner as a native speaker. I've worked with several developers that weren't native english speakers and they did code differently. I remember reading somewhere that Ruby written by Japanese is very different than the Ruby written by Americans. There may be one Universal Language, there there are numerous dialects.

  28. Avatar for Dominic Cronin
    Dominic Cronin May 29th, 2007

    I believe Pascal used to come with compilers that understood all its keywords in French... which rather reinforces your point.
    As for American English... as an Englishman with something of a love for English English, I still use American spellings in code, if only because it saves me the friction of having to remember one more thing. (All I need now is a way to avoid remembering whether the methods in a given library are PascalCased or camelCased.)
    Anyway - for the record, I hate that. Please could everyone agree to use English English spellings?

  29. Avatar for Haacked
    Haacked May 29th, 2007

    @BarryD - I totally disagree. Ruby isn't meant to be a business language readable by non-programmers. And why this picking on COBOL? It's still in use productively by many developers. Wouldn't that make it a success?
    Anyways, my point is why even bother trying to pick good names for your classes? Why even bother with object modeling, good variable naming, etc...?
    Because, as much as you like your curly brackets and funky += syntax, you still want to work with good abstractions that express the intent of your code. It's why we don't work with Assembler all the time ("don't worry, you get used to it if you're a *real* programmer.")
    Yes, we get used to our language constructs, but the more our code expresses our intent, the better for all developers, seasoned or otherwise.

  30. Avatar for Marcos
    Marcos May 29th, 2007

    I see some pretty cool things in Ruby and love how easy is to write code (more than any dynamic language)
    But like others think I preffer
    Is much more easy to understand, if you are reading code, you expect something like the c# one, is easy to underdestand to all.
    I dont think that the problems on software development are related to expressiveness, we have bigger problems that are addressed by Rails. But when c# 3.0 come out I will use a lot of extensions methods in my code, but not for that.
    Why add a Minutes method to the interger type !! not is too much ?? I know that this is based on the example of Hanselman, but not good as example.
    But I dont see simplicity in syntax so good =( in fact is more and more easy to no technical people to write code, and this maybe is not so good either :P
    Best Regards

  31. Avatar for BarryD
    BarryD May 29th, 2007

    I'm not exactly picking on COBOL, but pointing out how an attempt to have a language cleanly expressed in English failed.
    You talk about good abstractions; ++ for example is a good abstraction; all languages have meaning and their own terms, be it English, French or C++.
    You want to express intent? Fine; but English is not a suitable language for this, it's not structed enough, unlike, say Esperanto. English has massive problems, duplicate meanings for words, sentence structures that are not logical and so on.
    The time example is an interesting one; simply because of the Add method; if we had a subtract method as well
    DateTime.Now.Subtract(20 Minutes);
    that would be more expressive and easier to understand. The use of ago is, to my mind, too loose. Consider, how much is long ago? What about "next Friday"? The meaning of that (at least in UK English) changes, according to the day of the week. Say "next Friday" on a Monday and it's the Friday in that week. Say it on a Thursday and it's 8 days away.
    Code can express intent, and does, without syntatic sugar based on a natural language which doesn't lend itself to logical parsing.

  32. Avatar for Carl
    Carl May 29th, 2007

    As programmers, we all 'think' in the language that we use - be it c#, java etc.
    Although we generally write in English, we may not think in English (I think in English, but the real English, not that silly US version ;-P). A DateTime has a property of Now, we understand that; however I think that by using 20.Minutes.Ago, you are imposing English grammar and sentence construction onto the programmer.
    Personally, I think that the ruby syntax is horrible, and can't help wondering what possible reason there could be for it?
    I've seen comments about it showing clearer programmer's intent - to who, exactly?
    As a programmer, DateTime.Now.AddMinutes(-20) says a lot more about the intent - because I'm a programmer and it's written in my language. How much of a bonus is it that my Grandma would be able to understand the intent of the line '20.minutes.ago' better?

  33. Avatar for What The Funk?
    What The Funk? May 29th, 2007

    Are you serious?
    1. Yes most programmers speak some sort of english.
    2. 20.minutes.ago is ugly as a programming construct.
    How about:
    if the.time is.after 20.minutes.ago or the.time is.before then kill the.last.process.that.i.spawned.
    this is stupid.

  34. Avatar for Haacked
    Haacked May 29th, 2007

    @Barry,Carl - But constructs like ++ make up a small percentage of the actual code.
    Go over the best OO code you've written. Is it chock full of "++", "+=" or is it full of things like:
    customer.PlaceOrder(); (or order.Place(customer);)
    shape.Rotate(20, -1).Shear(1.5, 1);
    More than you "think in the language", you "think in the abstraction".

  35. Avatar for Scott
    Scott May 29th, 2007

    "Go over the best OO code you've written."
    Which is a whole other discussion. Is OOP the best way to write a program?
    Do you think "Me.Go("
    Or do you think
    "GoTo Store"
    Procedural vs. OOP
    IMO, the best code is a mix of procedural and OOP.

  36. Avatar for BarryD
    BarryD May 30th, 2007

    Functional surely? *duck*

  37. Avatar for Joe Brinkman
    Joe Brinkman May 30th, 2007

    Phil I think your analysis is flawed. There is a big difference between understanding words in a language as separately defined entities, from understanding gramatical structure. To you 20.minutes.ago make sense, but for some non-native speakers 20.ago.minutes makes more sense. The C# example only requires you to understand simple words without also needing to fully understand sentence structure, verb tenses and other gramatical constructs.
    If you don't think there is much of a difference - then try using one of the language translation tools to see the difference between translating a single word from translating a whole sentence. The same word will often be translated differently because of the added context provided by the other words in the sentence.

  38. Avatar for Haacked
    Haacked May 30th, 2007

    @Joe - I'm not yet convinced.
    Should the "foreach" operator be abandoned because for some native speakers, "eachfor" would make more sense?
    Should we name our variables CountMax instead of MaxCount, because in spanish, the adjective typically comes after the noun?
    No, we shouldn't because we have a reasonable expectation of some degree of English competency for developers working on most code.
    I don't want to get too stuck on the 20.Minutes.Ago example. The general point is that we're still trying to write code expressive in english.
    For example, instead of this:
    I'd prefer:
    The second is expressive in English and shows the user's intent better.
    Instead of:
    if("Is it in here?".IndexOf("it in") > 0)
    I'd prefer
    if("Is it in here?".Contains("it in"))
    if("it in".IsIn("Is it in here?"))

  39. Avatar for Who cares?
    Who cares? May 30th, 2007

    "Feel free to create a programming language with all its major keywords in another language and see how widely it is adopted. It’s a fact of life"
    The only fact of life is that American English speakers a 'lazy' (just to avoid stupid) enough to not learn other language and expect other people to learn and speak their language. Technically much more people speak other languages:
    So, from 6.5 billion only 0.341 billion English native speakers - around 5% (FIVE percent)!!! And a lot of them do not speak American English but British English. So, claiming anything like - historical reasons, great America etc etc is just excuse to keep yourself lazy :) Do not forget also the fact that most of the "great American's" are foreigners who are paid to do the job that native once can't :)
    There are human languages that are more precise, more expressive, more accurate and more short sentenced than American English and can be used even for programming.
    Between Ruby is one of the languages that tries to avoid exactly this defects of English language that is used in other programming languages. With Ruby you says more things with less writing.

  40. Avatar for Rob Conery
    Rob Conery May 31st, 2007

    Let's beat this horse to death :)
    I think someone above brought up the point about OOP, and someone whispered a breath of "Functional". That's really at the core of this - C# is very much a OO language, Ruby is a functional language - there's a fundamental difference in thinking and approach.
    And for all you wankers who complain that English is the Lingua Franca of programming - Really? I mean Really? (Phil insert that link here).
    When writing, we do think in terms of the language - it only makes sense. It's because we're expressing ourselves. When someone's reading what I wrote, they might very well not think like I do. In that case, can't we agree that a common method of understanding is, well, ENGLISH!

  41. Avatar for David
    David June 4th, 2007

    What's up with all the British English snobs?

  42. Avatar for blog blog June 6th, 2007

    Uiversale Progammiersprache? Englisch!

  43. Avatar for Brandon Stoner
    Brandon Stoner June 1st, 2010

    @Jon Limjap No. The proper term is American English. There is a reason that the following URL redirects to American English.
    If someone wants to say something in it's full name, don't correct them with abbreviations. If I say "I'll be right back, I've got to head to the store." I'd hope that you wouldn't correct me with "brb, g2g store".
    Same basic concept.