Ruby Isn’t It Great!

I’ve been keeping an eye on all the Ruby and Ruby on Rails hype. Thinking, wow, how exciting, I wish I had time to have a dabble. I really do want to get an environment sorted out and have a play, so I opened this article with great excitement and started to read. The excitement soon waned.

Ruby removes unnecessary cruft: (){};

  • Parenthesis on method calls are optional; use print "hi".
  • Semicolons aren’t needed after each line (crazy, I know).
  • Use “if then else end” rather than braces.
  • Parens aren’t needed around the conditions in if-then statements.
  • Methods automatically return the last line (call return explicitly if needed)

Ruby scraps the annoying, ubiquitous punctuation that distracts from the program logic. Why put parens ((around),(everything))? Again, if you want parens, put ‘em in there. But you’ll take off the training wheels soon enough.

The line noise (er, “punctuation”) we use in C and Java is for the compiler’s benefit, not ours. Be warned: after weeks with Ruby, other languages become a bit painful to read.

I’m sorry, but none of that is rocket science. I can code in a large number of languages, many of which don’t require a semi-colon to terminate a line. Several of which use if then else end instead of braces. Several don’t need parens around if statement clauses and I’m sure at least one or two return the last statement.

One of the languages that springs to mind is BASIC, and it’s many flavours. And yet, hard-core Java/C/C++ nuts switching to Ruby wouldn’t touch something like Basic or VBScript for exactly the same reasons they declare Ruby to be great.

Notice the points about pointless cruft and punctuation? Then notice some of the examples that follow on:

dictionary = { :cat => "Goes meow", :dog => "Barks loud."}

That strikes me as pretty crufty. Other syntax are equally illogical:

x = a || b || c || "default"

Frankly a lot of the reasons I see for Python or Ruby being so productive and great are the fact it’s just damn fast to script. Something those of us who’ve been scripting for years have known for a long, long time. I can knock something up in any of half a dozen scripting languages really fast. And have been able to since ‘96 when I first got into script languages. But, I’ve always been knocked by Java developers who think Java is the one true language. Seems that the Java guys and the other compiled language drones are finally turned on to scripting and blissfully unaware they’ve been slagging it off for years when others of us have been doing it.

Popularity: 63% [?]

2 Responses to “Ruby Isn’t It Great!”

  1. Ben Strackany Says:

    I saw the same article & also noticed that certain aspects of Ruby seem cruftier than others. I have a BASIC/C++/C#/VB background, so the Ruby syntax feels foreign to me. I personally don’t see the language as a big productivity boost for me (I feel pretty productive language-wise w/ C# 2.0 or VB.NET).

    Still, I’m looking forward to working with Rails for its other productivity enhancers like built-in unit testing, ORMs, code generation, & a thick framework — all of which I’ve experienced & enjoyed first-hand with other platforms & languages, but not all in one tightly-intergrated package like Rails. So we’ll see how it goes. I’m certainly not drinking any koolaid. :)

  2. THEMike Says:

    Exactly, the point being that RoR is being touted as “the messiah” by so many developers when it’s nothing new. It’s a scripting language with the issues of other scripting languages and a nice framework. Hell, look at PHP, ok it’s got the cruft (C-like) but there’s PHPUnit, Propel and the Zend Framework. And lots of other frameworks.

    Ruby has Rails. And a few other interesting Gems. The PHP Platform has a lot more, you’re not tied into one thing.

Leave a Reply