The first iteration in our project is over, and so is the first part of my experiment. The result: Ruby (Rails actually) wins by knockout!
I’ll start with the summary, in case you don’t want to read through the whole story:
It took me roughly 1 day to implement with Ruby on Rails what took me roughly a week of coding (net) in Java with Spring/Hibernate/Axis.
Actually, that’s not entirely true – the rails version has more functionality since I got the scaffold html CRUD interface for free!
It would have taken less than an hour had I known how to program Ruby…
Is this a knockout or what???
And now for the whole story:
In the past week I spent one day learning Ruby basics (just reading through the pickaxe book), and another half-day learning Rails (reading through to chapter 7 in the Pragmatic Bookshelf’s Rails books). At this point I felt that I’m ready to start.
It took me 20 minutes to get up and running with a scaffold web interface for my single DB table. Of these 20 minutes, 15 were due to the fact that I had to make some schema changes – rename some columns to conform to Rails defaults.
Next, I had to put a SOAP interface on my application. I read through Web Services on Rails, and soon thereafter my application had SOAP services that return 1 record, and all records from the DB table. That took maybe another hour, including learning how to write and run unit tests.
At that point I tried to add a service that adds a new record. That’s where I got stuck, since it turned out that you can’t pass an ActiveRecord::Base descendant as a parameter to an ActionWebService. The docs tell you to use an ActionWebService::Struct object, but I really didn’t feel like writing code that copies properties from my ActiveRecord to the Struct by name – what if I changed my schema and ran generate scaffold again? That meant I had to use reflection. In other words, I finally had to learn some more Ruby…
That was yesterday. It was getting late, and I had a date with some friends to watch football, so I had to go. Today I had a very long meeting that lasted through the morning, so I only went back to the problem after lunch. It took me another two hours to finish the work.
In the next post I’ll try to analyze how come the Java version took me so much longer. We have to keep in mind that this has been a very basic exercise so far. What I built is hardly an enterprise application, and Java definitely stands a good chance to come out on top in the next rounds. We’ll see.
In any case, I learned that there’s real substance behind the Rails hype.