Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Groovy vs. Ruby

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How much was Groovy influenced by Ruby? Are there problems that are more easily solved in Groovy than Ruby, or the other way around? Other than the fact the the JVM provides a much better runtime, what are the advantages of using Groovy over using Ruby?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me the greatest advantage between the two is that in Groovy I get to use syntax familiar to Java-land. I think it's easier to jump between Groovy and Java code without too much of a brain shift.

Ruby can run on the JVM too, by the way - JRuby.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Groovy parses the entire file and creates class out of it. I guess this does not happen in Ruby
 
Dierk K├Ânig
author
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter Johnson:
How much was Groovy influenced by Ruby?
Groovy was influenced by a number of languages. I see that following order (most influence first) :
* Java, because that is what we rely on and integrate with
* Python
* Ruby
* Perl (especially when it comes to what we try to avoid)
* Lisp
* all the other languages that the devs have ever worked with

Are there problems that are more easily solved in Groovy than Ruby...
Everything that requires tight Java integration, like using Java frameworks that rely on annotations or generics, writing an EJB, extending abstract classes that may have overloaded methods, cross-language refactorings, and so on...

...or the other way around?
When outside the Java platform, Ruby can start up faster which makes it better suited for writing quick-starting scripts like textmate bundles. With Groovy, you typically have a startup-delay of one second or so because of the JVM.

Other than the fact the the JVM provides a much better runtime, what are the advantages of using Groovy over using Ruby?
* leveraging existing Java knowledge (if any)
* using existing Java frameworks and components
* seamless mix&match of Java and Groovy implementations
I guess you see the pattern ;-)
If Java is of any value for you, then is Groovy. If you work in a total non-Java shop, then Groovy provides no benefit for you and you may take Ruby, C#, or whatever else.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic