August 31, 2005

Ruby vs Java

Writing about web page http://www.rubyonrails.org

Actually, it's not a Ruby vs. Java post as such, if you want a language p*ssing contest you can look here.

However, following on from last week's Flickr event, I've been devoting a bit of time to thinking about the alternatives to our current J2EE deveopment environment, and whether we can learn anything from them. I couldn't quite bring myself to try PHP, but Ruby seemed like an a suitable point of comparison.

So… Language-wise, Ruby is quite nice. It's properly OO, dynamically typed, with a reasonable exception system. Using begin/end instead of { and } makes my toes curl a bit, but at least it's optional.

Rails is to Ruby as (approximately) JSP,Spring&Hibernate (or JDO&JSF) is to Java; an MVC-ish framework, a templating language and a persistence framework. It's really easy to do basic CRUD in; the framework does most of the work for you and there are code-generators to get you started. However, if you want that sort of thing in Java you can have it, with something like appfuse

The (apparent) lack of a decent IDE is aggravating; I've got pretty used to just banging on ctrl-. ('fill the next bit in') and ctrl-1 ('fix this error') in eclipse, and having to go back to vi was a bit of a slap in the face. ISTM that this is one of the big disadvantages of a dynamically typed language. But the tradeoff is the instant deploy: change code, hit refresh, view results. I'd forgotten how efficient that makes things; I must try and get that working in eclipse again. This is especially a problem with Spring and Hibernate, both of which take ages to post-process a deploy for various reasons

For my next trick, I'm going to try and do something which isn't quite standard CRUD, to see if Rails is trading off flexibility for ease-of-use or not.


- 5 comments by 2 or more people Not publicly viewable

  1. GJ

    I had a (very) quick play around with RoR last weekend, and I'm quite impressed. I can't imagine it will be long before there's a decent Eclipse plugin for it (I didn't try the one I found, but from a quick glance it didn't look particularly good…) as FreeRIDE does seem rather crap. SCITE with it's syntax highlighting was enough for what I've done so far, but I'd at least want something with tabs for anything more serious.

    31 Aug 2005, 19:17

  2. I don't think the comparisons to JSF or JDO/Hibernate hold. JSF has components, whereas (if I understand correctly – I haven't actually used it) form controls in Rails are all methods on one humungous class. JDO/ORM frameworks (in Java and other languages, like Python) decouple classes from the datastore (allowing OOP, portability across datastore vendors etc), but in Rails, the classes are a dynamic product of the datastore structure, and if someone changes the database, your app fails unpredictably at runtime. I find that idea pretty horrific! The other corollary of that is that you desperately need a good IDE which can find all occurrences of a variable when you change a column. (Not to mention rename occurrences of a variable when you change its scope!)

    My overall impression of Ruby on Rails is that it might be good for getting things going quickly, but it's bad for building large, stable, maintainable systems.

    01 Sep 2005, 18:06

  3. Chris May

    Ah, my 'approximate' is more approximate than your approximate. I didn't meant that they have the same feature sets, just that they meet the same basic needs (i.e. 'how do I make HTML out of my objects' and 'how do I make my objects stick around after the applications shuts down').

    As to the datastore coupling; ISTM that most DB changes (renaming or dropping a column or table) will kill a JDO/Hibernate app just as effectively as a RoR one. The need for a decent refactoring IDE is spot on, though I bet that an old-school C programmer could probably hack something up with vi or emacs and CTags in no time).

    The last point was interesting enough to merit a separate post

    01 Sep 2005, 20:37

  4. Igor Drozdov

    Brian Hogan has done detailed write-up on setting Ruby development environment using RubyEclipse project.

    radrails.org has similar purpose, early version but working.

    Finally, I've heard that Komodo 3.5 (ActiveState.com) will focus heavily on RubyOnRails debugging etc.

    09 Oct 2005, 04:56

  5. Chris May

    I've been using RubyEclipse; it's OK-ish. But RubyEclipse and Radrails both suffer in that the debugger doesn't work if you use Ruby 1.8.2 (reqd. for rails) on the Mac. Which, unfortunately, is a bit of a must-have for me.

    I'll keep an eye on Komodo though: I used to like that when I wrote Perl scripts.

    09 Oct 2005, 06:59


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

Most recent entries

Loading…

Search this blog

on twitter...


    Tags

    Not signed in
    Sign in

    Powered by BlogBuilder
    © MMXXI