Thursday, December 22, 2005

More on Ruby

I've spent some more time with ruby. I'm not decided yet whether I like it. Perl was my first very high level programming language (unless you count Bourne Shell) and I fell in love with Perl when I learnt it. Even though I've moved on to Python for most of my stuff, Ruby reminds me of some of the nicer aspects of Perl. There's no question that Ruby is definitely a bettern Perl than Perl, at least syntax wise (as far as performance is concerned, Perl is still king).

Ruby syntax quite different from mainstream programming languages like C++/Java/C# because of statement modifiers and all those weird characters. On the other hand, it's object oriented syntax (i.e class definitions etc) is more traditional. There are private and protected methods. However, instance variables are always private and require method accessors (though it's easy to define them). Python is quite different, there is no protection at all at class level. On the other hand, Ruby classes are always "open", so you can just add another public method to access class internals. You can happily add attributes to objects after they've been instantiated in both languages (though ruby syntax is a bit tricky).

Oh, by the way. I didn't like the online book "Programming Ruby" first edition by the Pragmatic Programmers. Personally, I also didn't like "Pragmatic Programmer" very much, I think The Practice of Programming is a much better and lesser hyped book, but I am digressing. Coming back to Ruby, I found Ruby in a Nutshell a better a read.

One aspect of Ruby that I found frustrating is that most existing documentation covers Ruby 1.6 and there doesn't seem to a good changelog between 1.6 and 1.8 or even what's the changelog from 1.8.x to 1.9. Python changelogs on the other hand are very comprehensive and readable. And finally, of the three languages (Perl, Python and Ruby) Python development appears to be moving forward the fastest. Perl 6 is horribly developed and Ruby 2.0 and Ruby VM also seem to be badly delayed. In contrast, python appears to be making steady progress. Even projects like Jython, IronPython and PyPy have a vitality that's lacking in Perl and Ruby development. However, I must admit that Parrot development appears to be picking up recently and at least one Ruby VM, YARV, appears to be moving along quite well.

No comments: