This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Ruby and the fly likes Advantages of Ruby over Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Languages » Ruby
Bookmark "Advantages of Ruby over Java" Watch "Advantages of Ruby over Java" New topic

Advantages of Ruby over Java

sumeet gupta
Ranch Hand

Joined: Aug 31, 2008
Posts: 33
Hi Friends,

What do you think about advantages of ruby over java. Can I Opt ruby over java??

Joined: Dec 04, 2003
Posts: 4
I really like the dynamic nature of Ruby.
It's really suitable for DSL..

For fans of Tenacious D:

SCJP, SCBCD, SCWCD.<br />nerd.rd,, and nerd.m
Jason Mayer
Ranch Hand

Joined: Oct 16, 2007
Posts: 31
If those (the dynamic nature and being good for dsls) are the only things going for Ruby, then groovy might be a better recommendation. Java to Groovy is a pretty much instant transition, whereas there is a (slight) learning curve for Ruby.

That said, I really like Ruby and find it a joy to program in, even if these days I'm doing more groovy work.
Nick Plante

Joined: Sep 01, 2008
Posts: 13
Personally I think your choice of a language comes down to many factors. For me, Ruby is probably the most fun I've had developing in any language, and that means a lot. I've also received dramatic productivity boosts since moving over. There are certainly a few things that aren't perfect, but that's true of any language.

If you're coming from a Java background and interested in getting your feet wet with Ruby you may also want to take a look at JRuby. It runs in the JVM, can leverage existing Java classes, and deployment will be familiar -- it can be packaged and served as a WAR. And yes, it can run Rails.

Unfortunately I haven't had the time to play around with Groovy, so I can't make an informed comparison. I'd love to hear other peoples' thoughts on the matter though!
sumeet gupta
Ranch Hand

Joined: Aug 31, 2008
Posts: 33

I m pretty new to ruby.Can anyone refer me some books for jruby?
Nick Plante

Joined: Sep 01, 2008
Posts: 13
Although I haven't personally read it, Ola Bini's JRuby on Rails book might be a good start. I actually have a copy but just haven't found the time to dig in!
Nikos Pougounias
Ranch Hand

Joined: Jan 16, 2008
Posts: 110
Ruby has some features that a Java developer may well appreciate.

Example 1: Everything is an object

Example 2: Everything is a method: new, for loop, iterator, instanceof etc.

Example 3: Relaxed syntax

Example 4: Easy to remember API

Example 5: More compact code

Example 5: Every instance variable is by default private

Example 6: Define default values to method arguments

and many more.

I do agree with Nick that Ruby is fun!

Nikos' Java blog
I agree. Here's the link:
subject: Advantages of Ruby over Java
It's not a secret anymore!