Ruby and the don’t speek of the devil culture

As a constantly inquiring mind I don’t seem to rest with programming languages. As you know when the hype got me I took a look at the Ruby language. I was really impressed by the carry out of the project and the rails concept was exceptional. However while focused on the Rails framework and the 10m tutorials that require minimal coding, I actually didn’t learn a lot about the language itself. Not until last week that I got some free time to invest in learning Ruby. The outcome was : This language is not for me. It’s too superstitious!

In ruby you don’t go around calling names you don’t understand their powers. Silence is wit and silence is sometimes hard to maintain!

In case you are wondering what the hell I’m talking about lets meet this simple program:

a = -5.0
method = a.abs
I’m pretty sure that if we present the above code to 100 programmers (users of Ruby or not) will think that method is a reference to the method a.abs. I don’t know maybe I grew up this way! My mind is not oriented to see a.abs in the above code as a function call that results in method being 5.0. In Ruby you don’t go around calling names. You might stumble upon a method! And don’t you come up here and say that you can write a.abs(), too. That is what makes is even worst. If the language creates such an inconsistency (names of objects are references while names for methods calls them) it should at least try to make the programmer notice it by every mean. If you can write () at the end of methods you get the idea that () call it… that the parentheses are there and make a difference. While they don’t.

Maybe it’s just me but I find this inconsistency a very big issue. Magnified by the kind of use I think dynamic scripting languages are made for. In Python getting the reference of a function or method and passing it around as a parameter to other methods and functions is the same thing like doing it with variables. This leads to designing code with no worries, while in Ruby this is impossible. You have to always take care to determine what you are dealing with, and if you are indeed dealing with a method make sure you don’t mention it in a way that will call it. Calling a method is a very specific thing and the language should have an explicit way to do it.

And don’t tell me that this way the language can be used to write readable code and even worst don’t throw at me the usual examples like :

exit unless "restaurant".include? "aura"
5.times { print "Odelay!" }

and say that its almost English that even a non-programmer can understand! A programming language does not have to be English and we certainly don’t have to write code that is understood by a non-programmer. And even if they did understand the above silly examples that don’t say anything about what someone will understand if he look at the code of a real application written in Ruby.

In Ruby you also have a a.length that is the same with a.size. This happens with all the classes and is a design decision! I agree that this allows you to write code easily (if you are a programmer that is! If you are not you can’t write code in any language) because of all the duplicated definitions. This is only helpful at the first week of programming in Ruby and is valuable only if you are so lazy to open the documentation. On the other hand the consequences of it when reading code is disastrous. Ruby people says that reading a code that once uses lenght to get the list’s number of contents while other times uses size makes nice and readable code. To me this is stupid and I would spend my time try to figure what is the one doing and what is the other. It took me some time to convince that both do the same thing!

Maybe its just me but I really don’t get Ruby!

Happy coding!


  • I was hoping in Christmas vacations to take a good look of the Ruby Language ! But now… 🙁

  • You should never take the word of anyone about anything. I suggest you try it and have an opinion of your own.

  • Even if the second sentence is quite wise, the first one is part of a very destructive dogma… 😉

  • Interesting. I skimmed through the documentation of Ruby once, and thought it looked like an OK language. I don’t remember the issue you mention here, which is a bit ugly. It reminds me too much about the syntax rules for subroutine calls in Visual Basic. I always cringe when I read the word “optional” in syntax specifications, but in this case I guess the reason that Ruby is designed this way is so that you can access attributes and methods with the same syntax.

    Anyway, I can’t really seen the need for Ruby, as it is a lot like Python with a few nice additional features (and others not so nice). But perhaps Ruby is more like a competitor to PHP? It seems like the main reason for Ruby’s relative success is Rails, which seems to be a nice framework for web applications.

    Me, I have Ruby (and Rails) on my virtual list of “to try out” technologies.

    • Ali

      I had a rather hard time chnioosg just one type of physician I would want to work for. So many of them fascinate me, and with me not really going into any medical field other than support, I never gave this any thought in the past. After reading the list, I am more favorable of working for a neonatologist. It is difficult to think about how neonatologist physicians sometimes have the most difficult job in the world, but I can only imagine how amazing it would be to be a part of saving a baby’s life. I had a coworker once whose baby was born at 36 weeks, and her baby had a lot of heart and lung problems. There were concerns about whether or not they would ever fully develop once she had him, but after many months in the NICU, and many scares that happened during it, the doctors were able to save him and he is now a very healthy 5 year old. It is because of that I have a higher interest in the neonatologist field.I hate to say which type of physician I would care less to work for, and it is because I worry that many will take it the wrong way. When I was 16, I used to help my mom at an assisted living home as a caregiver. We would get to work at 7:00 A.M. every morning to prepare breakfast for four of the elderly men and women that we were caring for. We would then make sure that all bedding was changed, rooms were cleaned, meals were prepared, and appointments were handled. We worked 12 hour days, and they were always grueling. The owner of the home made sure that everyone had their medicine and made it to their doctor appointments on time. However, she was more worried about getting paid for her services than actually helping the elderly. She would yell at them if they did something wrong, and even call them terrible names. My mom reported her and we both quit our job, but it has always left a sting in my heart since then. It is because of my experience with that situation that I do not think I could ever work for a gerontologist. I know that the situations would be much different, but ever since my experience with caring for elderly individuals it is very hard for me to think about assisting a physician in geriatrics because I worry that someone else might treat the elderly in the same way the owner of the home did. I am a firm believer that the elderly deserve the ultimate care and comfort when going through any treatment and aging in general, but I do not think I could ever work in that environment again.

  • Ben

    5.times { print “Odelay!” }

    Sorry, but what’s difficult to understand about this line? It seems pretty straightforward to me, Ruby syntax or not.

  • 5.times { print "odelay" } Has nothing difficult to understand. You can easily imagine what it does. I just said that being easy to understand by non-programmers is not an issue for programming languages…

    I simply don’t care if my little sister can understand the above example…

    The problem with programming is always the algorithm and not the non-english systax…

  • Ben
    I just said that being easy to understand by non-programmers is not an issue for programming languages…

    I disagree. Code reading is a difficult skill to master. So many people prefer to roll their own solutions simply because they can’t be bothered to understand somebody else’s. Even re-reading your own code can be difficult, like returning to fix a bug in an application you’d written a year ago. Personally, I find writing code like this makes things a little easier:

    Item.ordered_since( 7.days.ago).each { |item| puts item }

    Anyways, to each his/her own. Good read.

  • Wow – I’ve heard some rants over minutiae before – but hating an entire language because of optional method parentheticals? That borders on insane. Don’t bite the finger, look where it’s pointing! You complain that the language duplicates “length/size” because anyone using the language for a week would learn just one (the duality, incidentally, is product of language evolution – not forethought) yet complain that you are confused by the lack of method parenthesis? I deign to see no difference.

    method = a.method( :abs )


  • Greg

    I never understand these syntactical whack-outs stressed over by some coders. I didn’t get it when everybody and their sister was busy wigging out over sigils in Perl — too many punctuation marks, whaaaa! too many symbols, whaaaa! — and I still don’t get it now when coders bust their hangnails over mandatory indentation in Python or, as the case is here, some optional syntax in Ruby.

    My take on it is this: who effing cares? There was a time when I spent muchas horas looking at Perl code. I got used to it. The sigils/symbols/punc-marks didn’t bother me, and when bloggers began fooing and barring over all that syntax, I guffawed at their public display of inexperience and I openly mocked them. “I mock you!” I said, sometimes to their faces, depending on their temperament and relative bodyweight.

    Come on, man. There is SO MUCH to Ruby besides some effing stoopid optional parens, or duplication of method names (which happens in some other languages, too), that if this is far as you got evaluating the language, then I seriously question your qualifications to offer commentary.

    Any language used long enough will become easier to read and understand. For years I coded in C++. Now that can be difficult to understand, even when coders are rigorous about method naming and coding standards. It’s difficult because of contextual usage of language semantics and the way syntax, even fairly straightforward syntax such as is used with templates, can be used, and sometimes must be used, to do some gnarly coding. With Ruby, most gnarly coding is unnecessary. I could say the same for Python too.

    Maybe it’s just me but I find this inconsistency a very big issue.

    I’m sorry, man. I think it’s just you.

  • zed

    I’m a programmer so I could be one of the 100 programmers you mentioned – “method = a.abs” looks fine to me. Please don’t use generalizations to back up your opinions.

  • I think it’s something that might surprise you the first time you see it, but once you see why is that way, you will find it overly natural.

    In ruby, you don’t invoke a method on an object. You send him a message, and he replies something (maybe it replies nothing, like puts, who returns nil, or maybe they complain that they didn’t understand your message (ie, they throw an exception on an invalid method).

    No, really, is that simple. It’s not about if this is a method or an invocation of a method. It’s just a message. It might confuse you the first time, but after that, it shouldn’t 🙂

    • Wow! Talk about a posting knnickog my socks off!

  • Uhm, sorry about the formatting, didn’t expect that the <code> tag would end up with display: block.

    Maybe a live preview would help 🙂

  • Porta
    A programming language does not have to be English and we certainly don’t have to write code that is understood by a non-programmer

    Why not? is it forbiden?

  • I can understand if you are a pythonista how you might expect that a.abs would return a reference to the abs method, but frankly, ruby approaches this in a different manner and it makes perfect sense if you consider the following:

    You don’t access fields on objects, and you don’t call methods: all you do is send messages to objects. It is just the opposite side of the pythonic way, not wrong, just different.

    In python, the word after a period is a field access, in ruby, its a message.

    • Yes, it is a bit unusual, but I like it. Folks aornud here park old bikes in their yards in the summer with plants and flowers in the basket. I really like the Christmas idea, but I’d love to send you some SNOW!.Have a wonderful holiday.Merry ChristmasB.

  • “I’m pretty sure that if we present the above code to 100 programmers (users of Ruby or not) will think that method is a reference to the method a.abs.”

    Users of Ruby or not? Are you telling me that if you showed your example to a collection of Ruby developers, they’d be dumb enough not to know their own language? I sense you have a serious point to make something under all of this, but this article is just pure hokum (and as a troll, it has worked splendidly).

    “If the language creates such an inconsistency (names of objects are references while names for methods calls them) it should at least try to make the programmer notice it by every mean.”

    You’re clearly trying to think of Ruby from a closeted C-esque viewpoint. It’s easy to think that’s the only viewpoint if you were brought up on C, but it’s not. You need to look at things from a more LISP / Smalltalk-esque point of view when dealing with languages like Ruby.

  • I agree with Harry. The syntax of the language should make it always clear what is happening.

    I have also looked at Ruby, and it also not for me.

    That doesn’t mean it is a bad programming language, it means that I don’t like it.

  • Peter Cooper : I base the assumption for the 100 programmers on what I had discused with several computer science students. Maybe you would be suprised to find out that 90% of CS students are not much of hackers, but these are still the people that work on IT positions when graduate. Seven of the students knowing Ruby I presented the “method = a.abs” said that they got the reference. Only one of them got it right and he was part of the local linux group…

    What do you think will happen when these people are presented with a big project based on Ruby? This will be an other source of hasle for them.

    Bem : Item.ordered_since( 7.days.ago).each { |item| puts item } The above code is truely self expanatory. But I’m sure that you could understand it easily even if it was writen in C. Its not something exceptional in that code that is hard to understand. That syntax helps a lot the person that is not aware of the language and tries to understand it with his english skills. And he will understand it, which is a success. But what happens if he wants to fix a bug on a syntax like that? Easy readability does not give you easy writing axiomaticaly.

    This like the ancient greek language. Even with little knowledge of the language you can easily read an one line sentence that is so complete and full of meanings that can mind blow you. However you will never be able to make an intervention without having truly mastered the language. The language remains the most dificult in the world…

  • On how many languages this code:

    a = 5.0 method = a.abs()

    will return a reference to a method called abs() on a? Include me OUT of those 100 programmers that will undertand it that way. They are certainly not very friendly with OO languages..

    Ruby is not greek… It is not so easy as some other languages too, because of a couple of concepts that are hard to follow to C++/Java heads (namely closures and blocks/yields)

    And by the way, the “it’s easy to read as english” thing is from poygnant ruby. So you might be ranting over a book, which was written by someone that doesn’t have anything to do with the language design…

  • Miles

    It’s really interesting to read opinions about a language by someone who admittedly knows very little about the language. Especially when the opinions are picking at something extremely superficial, because they don’t know enough about the language to have anything else to comment on.

    I mean no offense, so I apologize for the harsh tone, but I have seen several articles lately involving someone complaining about a language having only spend a very small amount of time with it.

    You must have been speaking with some really naive CS students, and although they claim to be learning Ruby, they also must have only spent a week with it, if that. I still don’t understand why you would think a.abs would return a reference to a method. Maybe you’re thinking TOO hard.

  • ylon

    Sorry, to me your post seems a bit strange and I guess I could say “I don’t get it” in reciprocal. 🙂 Perhaps you are thinking “too hard.”

  • Mark

    As Nicolas and later Scott pointed out, in Ruby you don’t invoke methods. You send messages. Just try to understand that, and the rest follows 😉

  • “Even if the second sentence is quite wise, the first one is part of a very destructive dogma…”

    @ Harry: I’m not ranting about life, apparently. I’m talking about programming languages.

  • Lisp must blow your mind.

  • Hail to the flames…

    I just don’t like the language.. get over it! It might be the best language in the world, I just said that it is not for me… and explained the reasons. And tried to do so in a lightsome way. Why does everyone have to like the language you like? Don’t get it personal… Its not like I was calling your mothers names! 😛

    Aggelos : I was talking about programming languages too!

  • Then why it is destructive? I can see why it is if someone is talking about life. But programming languages?

  • joe

    The article writer is correct – Ruby and Python have many serious design flaws that seem minor and ‘convenient’ but greatly hamper the languages in other ways (Python – is it not obvious why lambdas are limited to one line? and what that costs you in trying to write anything functional style. and my favorite of all, the nonlocal keyword (Python 3k)… coming to a Ruby near you too.. eventually). The Perl symbols before variables is just stupid, the reason you have it in other languages is to escape text, and notice how everything uses ‘strict’ now, almost as if the language without it was inadequate (hint: it was).

  • qwerty

    “I just don’t like the language.. get over it! It might be the best language in the world, I just said that it is not for me… and explained the reasons. “

    If you understood the language, your criticisms would be better taken.

    You showed a 5 minute understanding of the language.