Meditations on programming, startups, and technology
New Relic

Ruby rocks and Java sucks?

Java VS Ruby

Many hackers are quite religious about their programming language of choice, but I’m not. Whenever possible I try to be rational about things that matter to me. For this reason you won’t hear me saying things like: “Ruby rocks, Java sucks!”. Indeed Ruby rocks, but it does so for me, for the kind of development that I love to do and for the way I like to think and express my thoughts in code.

I am quite confident that Ruby would be a great programming language for a broad audience of hackers worldwide, but this doesn’t mean that we should belittle those who happen to work with Java, C# or other “bureaucratic” language. On the web there are thousands of threads about “Java vs Ruby”, “PHP vs Rails”, “Python vs Ruby”, “C# vs Java”, and so on… this is mostly non-sense. Of course all these languages have differences that will determine your life as programmer, but you really need to go and try them out for yourself. Spend time selecting and learning your development platform, experiment, and if possible learn more than one language and framework. Different paradigms can be a huge gain for the programmer in terms of flexibility. I really love to work with drills, but sometimes you need a screwdriver, or just a hammer. “Buy some tools” keep them in your toolbox, and then use the ones that will let you do the job better. Or that are requested by the company were you work or by the client, or again that you enjoy using the most.

Some programming languages let you be more productive than others in particular circumstances, create a more maintainable code and so forth. Assembler is definetely less “human-friendly” than Python for example. But in the field of general purposes languages, the real bottleneck is often the programmer not the language! It’s your level of mastery of the language, that makes the difference in most cases. I love Ruby and it is in my opinion, a slightly better language than Python, but at the moment I am not half as productive in Ruby as Alex Martelli is in Python. :-)

One day my wife asked me why I was so passionate about Ruby, while I used to be interested in C# a lot. She asked me what the difference is and the advantages are? Now, she is a very smart woman, but she hasn’t a programming background so I tried to explain to her without going into details like dynamic languages, meta programming, ORM, and so on. She mostly got what I meant but I was looking for a more effective and direct way of illustrating the concept.

A few days ago I remembered the funny photo that you can see on the top righthand side1. That’s probably the best answer: simplicity. Ruby doesn’t get in the way and it lets you express your ideas, because Ruby is as simple as possible but not simpler as Einstein would say. You don’t need a dozen books to master Ruby or Web development with Rails, you just need a couple of books, a brain and some practice.

(1) I’d like to give credit to the author of the photo, but I don’t know who originally took the picture. I’ve only added the Einstein quote and rounded the corners.


If you enjoyed this post, then make sure you subscribe to my Newsletter and/or Feed.

receive my posts by email

7 Responses to “Ruby rocks and Java sucks?”

  1. James says:

    Ruby is as simple as possible but not simpler.

    Well, no. Ruby is pretty clean, but still has its share of quirks and expections.

    Lisp is probably simpler than Ruby, but that may be why it has yet to achieve the same mass appeal as Ruby.

    It’s not that a language should be as simple as possible, but that it should find that difficult mix of conceptual purity and practical consideration.

    There are things added or omited from Ruby because they made certain common tasks easier in the long run, at the expense of a trickier upfront learning curve.

    (The problem is worse in Rails, as the number of forthcoming Rails books attest.)

  2. Well, no. Ruby is pretty clean, but still has its share of quirks and expections.

    It’s not that a language should be as simple as possible, but that it should find that difficult mix of conceptual purity and practical consideration.

    There are things added or omited from Ruby because they made certain common tasks easier in the long run, at the expense of a trickier upfront learning curve.

    Hi James,
    thanks for your comment. When I indicated that Ruby’s strength is simplicity I did so considering what other alternatives are available in the real world. Ruby is definitely simpler than Java or C#, and in general Ruby is quite a simple and clean language.

    This doesn’t mean that you won’t require time to learn Ruby or that it doesn’t have complicated features, but what Ruby does excellently is enable you to be up and operating in a very reasonable amount of time.

    When I say “as simple as possible but not simpler”, the word “possible” does imply a compromise and I agree with your consideration about how programming languages should omit or exclude characteristics also based on real life requirements. I included “not simpler”, because otherwise the language is oversimplified (simpler than practically possible) at the expense of needed features. In the end Einstein said that famous quote speaking about the universe, which isn’t the easiest thing to understand. :-)

    Lisp is probably simpler than Ruby, but that may be why it has yet to achieve the same mass appeal as Ruby.

    Lisp is a great language, I equate the lack of Lisp popularity to the fact that it is missing its own “Rails” killer web framework to bring hype to an otherwise 40 year old programming language. It’s sad but the popularity of programming languages often seems to have very little to do with the merit of the language itself. In Ruby’s case most people are studying it because they want to be productive with Rails. Au contraire, I’d say that it is smart to study Ruby just because Rails is an excellent example of how well you can design DSL in Ruby.

    (The problem is worse in Rails, as the number of forthcoming Rails books attest.)

    In my opinion, the number of books has much more to do with the hype and the wide adoption that Rails is gaining rather than the necessity of many books to simply understand Rails. Agile Web Development with Rails gives you all you need to let you work comfortably for a while, I think.

    PS: Thanks for the links, “blank”. ;-)

  3. Phil says:

    Argh… textile please?

  4. Phil says:

    Heard on #ruby-lang:
    19:49 will people stop glorifying lisp? it’s a very good tool, but just like the sharpest sword which can’t slice through the air by itself, the quality of the wielder matters more I think it applies here, too.

    _Agile Web Development with Rails gives you all you need to let you work comfortably for a while, I think._

    Yeah, if you’re developing for Rails 0.12…. =D

  5. Hi Phil,
    I’ve enabled Textile comments and reposted your comment accordingly.

    Cheers,
    Antonio

  6. EleoChan says:

    Since I’ve really gotten into programming, it seems that for every language there is someone telling me why it sucks and which language I should _really_ be using.

    In the end, after examining all of these languages, it turned out that each language is equally valid; most usually where it fails in one respect is succeeds in another. But despite this people continue to attack other languages. (There are some exceptions. I’ve never really heard anyone say that C is a dumb language, but I have heard that it is not recommended for all projects, which is probably true – just like in any language.)

    Mostly, my internal struggle against programming languages is the actual language versus the end result. I find Ruby fun to use, but am I going to easily code a first person shooter with it? I like Java’s platform-independence, but it’s resource usage is high. The actual programming process is important for my sanity but at the end of it all it has to work for the users.

Copyright © 2005-2014 Antonio Cangiano. All rights reserved.