Ruby vs. Groovy: your perspective

D

Diego Virasoro

Hello,
I realise this is a very hot topic... and people have strong feelings
about either language. I am not trying to trolling.

Still I've heard a bit about Groovy and it kind of seems like the Java
answer to Ruby (even the names are kind of similar). So I was
wondering if that kind of "first citizen" status will eventually make
it take over Ruby as a dynamic language (assuming that indeed that the
Groovy language offers everything Ruby does).

I checked online, but websites are either very old, or too "official".
So I wanted to ask my fellow Ruby programmers, who probably share
similar preferences to mine.

Note: I am not sending this to the Groovy list or the Java list. I
don't program in either, I program in Ruby, and what I am looking for
is not an "official" intro to Groovy, just some opinions from Ruby
users. Many things are about personal preference, not checking boxes
on a list. (for that there's wikipedia) :)

So thoughts? Does Groovy (the language) have everything to offer that
Ruby does? And the fact that it was designed to be used on the JVM
from they one gives it an advantage (I know I can keep use Ruby, but a
strong community means more libraries out there, more books, and in
general more help).

Fire away. :)

Diego Virasoro
 
D

Dylan Evans

[Note: parts of this message were removed to make it a legal post.]

Use whatever language makes you happy (i do). There is plenty of room among
programmers to accommodate new languages and they tend to bounce idea off
each other which keeps development from getting stale, languages don't just
die because something new came out, for example you can still find
contingents of pascal programmers around. One issue with groovy is (at the
moment) shackled to JVM which has both it's pros and cons. Overall groovy
looks like an interesting language but for the moment i don't have a
compelling reason to use it.
 
G

Gregory Brown

Hello,
I realise this is a very hot topic... and people have strong feelings
about either language. I am not trying to trolling.

Still I've heard a bit about Groovy and it kind of seems like the Java
answer to Ruby (even the names are kind of similar). So I was
wondering if that kind of "first citizen" status will eventually make
it take over Ruby as a dynamic language (assuming that indeed that the
Groovy language offers everything Ruby does).

I am not really familiar with Groovy, but I'm somewhat surprised you
didn't mention JRuby here.
It runs on the JVM, lets you access the wealth of the Java libraries,
and is fully compatible with Ruby 1.8.6.
It is also targeting Ruby 1.9 features over time.

So I'm not sure why I'd use something "like Ruby" if I could just use Ruby.

-greg
 
D

Diego.Virasoro

Use whatever language makes you happy (i do).

Well, that was the plan. And currently Ruby seems more elegant. But is
this true? And is it more powerful? And it's easier to use? I dunno. I
guess I could pick a book and start reading it. But currently I don't
have much interest in learning Groovy if in the end it ends up exactly
like Ruby.

So I was hoping someone who has tried both could tell me a little bit
more on their opinion.
 
D

Diego.Virasoro

I am not really familiar with Groovy, but I'm somewhat surprised you
didn't mention JRuby here.

You are right... and I think I've not explained myself very well. I
was interested to hear people's opinion about Groovy to get an idea if
I may want to invest some time in learning it or not.

To this end, I currently have two main concerns:
1- A language I enjoy using. Ruby is such a language so far (apart
from the speed). On the other hand is Groovy? Are the two really on
feature parity? What are their advantages over each other? I could
find very little recent stuff on Groovy, and as you put it << I'm not
sure why I'd use something "like Ruby" if I could just use Ruby >>. So
what is the feeling of the Rubyist that have already looked closely at
Groovy?

2- A language that will be around for a (relatively) long time, and
with a strong community support. I mean, I know Ruby per se would not
disappear if people stopped using it, but still, with little support
there are less libraries, and the technological world is a moving
target, so a language with no development would slowly become less and
less useful.

So I am sorry I confused everybody by mixing the two points. I was
trying to address both points in the opening post, but I didn't
distinguished the two questions very well. I hope things are more
clear now. :)

Diego
 
J

James Gray

And currently Ruby seems more elegant. But is this true?

This is pretty much personal opinion. Which ever one feels better to
you is better.
And is it more powerful?

There's no such thing. Both languages are Turing Complete (http://en.wikipedia.org/wiki/Turing_complete
). Thus, they are literally capable of the same things.
And it's easier to use?

Again, that's pretty much personal preference. What's easy for me may
not be easy for you.

James Edward Gray II
 
J

James Gray

I was interested to hear people's opinion about Groovy to get an
idea if
I may want to invest some time in learning it or not.

Well, learning new languages is a good thing. I've enjoyed most of
what I've worked with, even if they didn't replace Ruby for me.
1- A language I enjoy using. Ruby is such a language so far (apart
from the speed).

I've been pretty impressed with 1.9's speed. Time to make the switch!
2- A language that will be around for a (relatively) long time, and
with a strong community support.

While some languages do die, I think it's a pretty rare thing. Most
languages are still around in some form and generally have a community
supporting them.

James Edward Gray II
 
T

Tony Arcieri

[Note: parts of this message were removed to make it a legal post.]

Still I've heard a bit about Groovy and it kind of seems like the Java
answer to Ruby (even the names are kind of similar). So I was
wondering if that kind of "first citizen" status will eventually make
it take over Ruby as a dynamic language (assuming that indeed that the
Groovy language offers everything Ruby does).

One of the most powerful Ruby idioms I know of requires features Groovy
doesn't have. I'm talking about creating a small declarative "DSL" you call
from a class body to metaprogram methods, such as with ActiveRecord
associations, e.g.:

class Foo < ActiveRecord::Base
has_many :bars
has_many :bazzes, :through => :quuxes, :eek:rder => "created_at DESC"
end

This allows for instances of Foo to potentially respond to many different
methods based on the association names (e.g. you can call afoo.bars to get a
collection of associated bars)

Groovy does not allow code in class bodies (at least last I checked), and I
believe Grails tries to work around this with static properties, which can't
provide the full expressive power of a DSL.

I've heard generally bad things about Groovy's approach to metaclasses and
metaprogramming in general, but as I haven't used Groovy I can't really
comment in that regard.
 
E

Eleanor McHugh

So thoughts? Does Groovy (the language) have everything to offer that
Ruby does? And the fact that it was designed to be used on the JVM
from they one gives it an advantage (I know I can keep use Ruby, but a
strong community means more libraries out there, more books, and in
general more help).

I followed Groovy development for a while (between 2004-2006) and
liked what I saw, but ultimately gave up on developing for the JVM and
lost interest. Were it to break out of that particular ghetto I think
it could gain in popularity, although from what I recall it's similar
enough to Ruby in many respects that it might be difficult to
differentiate itself.


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
 
M

Martin DeMello

I followed Groovy development for a while (between 2004-2006) and liked what
I saw, but ultimately gave up on developing for the JVM and lost interest.
Were it to break out of that particular ghetto I think it could gain in
popularity, although from what I recall it's similar enough to Ruby in many
respects that it might be difficult to differentiate itself.

Clojure pushes the jvm as a strength [http://clojure.org/rationale].
It's certainly nice to have all those libraries for free and a
well-optimised vm, though I got a trifle disillusioned when I wrote an
app in it and discovered that yes, swing does suck. (Some day I'll
work up the energy to scrap the UI and rewrite it in QtJambi)

martin
 
C

Charles Oliver Nutter

Eleanor said:
I followed Groovy development for a while (between 2004-2006) and liked
what I saw, but ultimately gave up on developing for the JVM and lost
interest. Were it to break out of that particular ghetto I think it
could gain in popularity, although from what I recall it's similar
enough to Ruby in many respects that it might be difficult to
differentiate itself.

I don't know if I'd consider the JVM a ghetto :) At any rate, I think
there's practically no chance of Groovy ever living anywhere but the
JVM, since they're tightly intertwined with both Java the platform and
Java the languages.

- Charlie
 
E

Eleanor McHugh

I don't know if I'd consider the JVM a ghetto :)

Well I'll concede that the JVM does have a few things going for it,
but I never was entirely comfortable with having my code tightly
coupled to it. The Groovy guys have a different outlook and good luck
to them for that - if we all thought alike we'd never get anywhere lol


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
 
J

James Britt

Charles said:
I don't know if I'd consider the JVM a ghetto :)


In some ways MRI is more of a "ghetto" in that if you ever end up using
a native-code library you may find it hard to run you code on multiple
platforms, whereas if you use JRuby with Java libs you have far more
portability.


As it stands, it's a fair bet that Ruby + Java gives you more libraries
than Ruby + C.

That's not to claim there are no downsides to running on the JVM, just
that the Java platform seems to have been tagged with a very outdated
image, and people are doing themselves and others a real disservice to
so blithely dismiss it.



--
James Britt

www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
 
A

Albert Schlef

Eleanor said:
Well I'll concede that the JVM does have a few things going for it,
but I never was entirely comfortable with having my code tightly
coupled to it.

When you're writing in Ruby, your programs are tightly coupled to the
Ruby interpreter. Why is that better than having a program coupled to
the JVM?
 
M

Michael Neumann

In some ways MRI is more of a "ghetto" in that if you ever end up
using a native-code library you may find it hard to run you code on
multiple platforms, whereas if you use JRuby with Java libs you have
far more portability.

Portability is very subjective :)
For many years, Java was only supported on a handful of platforms,
others like for example FreeBSD weren't (I'm talking about Sun's Java
here).
I still can't run Java and depending applications like OpenOffice on a
specific operating system, until OpenJDK becomes ready.

Portability for me means, that I have full access to the C/C++ code, and
it compiles easily on every platform. Welcome to Ruby :)
As it stands, it's a fair bet that Ruby + Java gives you more
libraries than Ruby + C.

Sure. But does it give us more quality? My own (limited) experience
with Java was that it's very hard to find a usable, bug-free HTML parser
in Java (TagSoup without bugs), which on the other hand was very easy in
Ruby (Hpricot).

Regards,

Michael
 
M

Michael Neumann

When you're writing in Ruby, your programs are tightly coupled to the
Ruby interpreter. Why is that better than having a program coupled to
the JVM?

Ruby is open-source. Ruby runs everywhere.

Regards,

Michael
 
C

Charles Oliver Nutter

Michael said:
Portability is very subjective :)
For many years, Java was only supported on a handful of platforms,
others like for example FreeBSD weren't (I'm talking about Sun's Java
here).
I still can't run Java and depending applications like OpenOffice on a
specific operating system, until OpenJDK becomes ready.

Portability for me means, that I have full access to the C/C++ code, and
it compiles easily on every platform. Welcome to Ruby :)

http://robilad.livejournal.com/44589.html

I'm also running the BSD port of OpenJDK on Mac right now.
Sure. But does it give us more quality? My own (limited) experience
with Java was that it's very hard to find a usable, bug-free HTML parser
in Java (TagSoup without bugs), which on the other hand was very easy in
Ruby (Hpricot).

http://java-source.net/open-source/html-parsers

No promises, of course, but there's a lot more to pick from.

- Charlie
 
E

Eleanor McHugh

In some ways MRI is more of a "ghetto" in that if you ever end up
using a native-code library you may find it hard to run you code on
multiple platforms, whereas if you use JRuby with Java libs you have
far more portability.

All platforms are ghettos by their very nature. In the case of Groovy,
it's a language closely coupled to a particular platform - the JDK -
which is out of the control of its creators and therefore breaking
free from that ghetto could prove too difficult to be worth the
investment. That's a pity for Groovy because it's a language that's
fun to play with and that freed of the JDK constraint might not look
out of place rubbing shoulders with Ruby and Python.
As it stands, it's a fair bet that Ruby + Java gives you more
libraries than Ruby + C.

That's not to claim there are no downsides to running on the JVM,
just that the Java platform seems to have been tagged with a very
outdated image, and people are doing themselves and others a real
disservice to so blithely dismiss it.


I've been coding for almost thirty years, and for ten of those I
followed the JVM closely enough to have been a reasonable JASM coder.
So if I'm blithe in my tone, that's not without having formed an
opinion through experience and come to the conclusion that I want *and
need* my code to live in a world larger than that circumscribed by the
JDK.

In Ruby that's easy as Charlie and his confederates have built me a
first-class tool to use in JRuby with very few restrictions on the
kind of Ruby code it'll support, whilst MRI still gives me support on
a host of other platforms thanks to its ANSI-C implementation. For the
Groovy folks that could well be impossible.


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
 
R

Robert Dober

Ruby is open-source. Ruby runs everywhere.
Well so is the JVM, open source and run everywhere :). But to add to
your answer, it is better to be coupled to Ruby than to the JVM,
because you are one abstraction higher and although JRuby is a great
thing to use you do not depend on the JVM, which is good. If use JRuby
because you depend on Java features you do not loose anything, because
you are bound anyway. If you use JRuby for other reasons you will not
be bound to JRuby and can use any other rubyspec compliant
implementation :).
Robert
--=20
Si tu veux construire un bateau ...
Ne rassemble pas des hommes pour aller chercher du bois, pr=E9parer des
outils, r=E9partir les t=E2ches, all=E9ger le travail=85 mais enseigne aux
gens la nostalgie de l=92infini de la mer.

If you want to build a ship, don=92t herd people together to collect
wood and don=92t assign them tasks and work, but rather teach them to
long for the endless immensity of the sea.
 
R

Robert Dober

All platforms are ghettos by their very nature. In the case of Groovy, it's
a language closely coupled to a particular platform - the JDK - which is out
of the control of its creators and therefore breaking free from that ghetto
could prove too difficult to be worth the investment. That's a pity for
Groovy because it's a language that's fun to play with and that freed of the
JDK constraint might not look out of place rubbing shoulders with Ruby and
Python.

Hmm are you sure about this? Charles implemented Ruby on the JVM, a
priori that seemed much harder than to implement Groovy on the say
LLVM, or do I miss something here?
R.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top