Ruby
Posted by marshall Wed, 17 Mar 2004 19:00:00 GMT
I've started messing around with the Ruby programming language lately. So far I really like it -- much more than any language I've used in recent memory. It takes the best things about Smalltalk, Python, and Perl, and mixes them together into a wonderfully elegant, highly productive, truly object-oriented syntax, with lots of helpful built-in modules. It's probably going to be the language I use for shell scripts from now on, at the very least. Unfortunately, it's not that popular yet outside of Japan, and the cross-platform graphical user interface libraries for it are still immature.
A few links:
- You can learn to program using Ruby
- There's a complete well-written book on Programming Ruby available for free reading on the Internet
- Ruby is included in Mac OS X, and there is even support for Cocoa through the RubyCocoa framework. The included version of
irbdoesn't havereadlinesupport, though, which means it can't do command line editing and completion. Follow these instructions to update to the latest version and fix this.
Just for kicks, I took a little Java program I had written a while back to compare weather reports and re-wrote it in Ruby. It went from over 370 lines in Java down to around 130 lines in Ruby. A 65% decrease in size! What's more, the Ruby version is easier to read and modify. Amazing stuff.

And if those links are too lifeless and dry, here's a distinctively surreal on-line book that will either make Ruby absolutely clear to you or drive you to the brink of insanity:
http://poignantguide.net/ruby/
It would be interesting to see and compare the 2 pieces of code written in Java and in Ruby (could they be posted...?).
What is it that makes the Ruby code so much shorter? And could the Java code be made shorter by pulling things out into libraries etc.?