From: Alexey Verkhovsky Date: 2005-04-19T14:35:19+09:00 Subject: Ruby vs Java experiment It is obvious to anyone on this list that Ruby is more expressive than Java. But maybe someone is curious how much more expressive it is. Here is one data point: CONTEXT I was doing a ThoughtWorks coding problem this weekend. It's a part of TW recruiting process, and yeah, I must be another fowlbot wannabe :) The problem was typical billing stuff. Read a plain text invoice file, parse it to name / quantity / price, validate, calculate some sales taxes. All the usual contortions of money arithmetics, some regexps, not much more. To be solved with standard libraries of the language. The twist in the plot was that I was asked to do it both in Ruby and Java. I did that, first in Ruby and then ported the Ruby solution to Java. Exactly same functionality and very similar design. I consider myself familiar with both languages (not a world class wizard, but wrote quite a bit of code in either). And I don't hate Jav. So, it was a reasonably fair experiment. DATA For whatever it's worth, the line count: Ruby: 238 lines, Java: 655 lines, ratio 1 : 2.75 These are simple \n counts, not NCCS or other such metrics, but I think any "amount of code" metric (as oposed to code complexity) would get a similar ratio. P.S. I'm scared to think what would it take to implement the same solution in C (standard libraries only => no regexp to begin with). -- Best regards, Alexey Verkhovsky Ruby Forum: http://ruby-forum.org (moderator) RForum: http://rforum.andreas-s.net (co-author) Instiki: http://instiki.org (maintainer)