Ruby vs. Groovy: your perspective

D

Diego.Virasoro

This is pretty much personal opinion.  Which ever one feels better to  
you is better.
Yeah, I know. But since I've never written anything in Groovy and it
takes time to learn the subtlties of the language, I was asking fellow
Rubyists for their opinion. If you want you could rewrite the question
as "which one does it feel better for you, and why?".
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.
Mmm... that sounds a lot like fine semantic details. :/
I agree powerful was a pretty generic term, but I thought it was
pretty clear. The fact that Ruby is so dynamic, for example, I'd say
makes Ruby pretty powerful: you can easily and tersely write complex
programs. And allows you to do things that other languages don't (or
are much more complex and/or time consuming).

Again, that's pretty much personal preference.  What's easy for me may  
not be easy for you.
Yep, and I was asking for your personal preference... sorry if I
seemed to imply I wanted to get an objective, balanced, correct
opinion. That is an oxymoron, I agree. I was asking the opinion of
other Ruby users.
(I assume someone in the list has probably tried Groovy, or may even
use both)

Diego
 
D

Diego.Virasoro

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.
Thanks that's exactly the kind of tidbits I was looking for.

Diego
 
M

Mark Thomas

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).
Hmm...

jruby -S gem install hpricot
JRuby limited openssl loaded. gem install jruby-openssl for full
support.
Successfully installed hpricot-0.6.161-java
1 gem installed
Installing ri documentation for hpricot-0.6.161-java...
Installing RDoc documentation for hpricot-0.6.161-java...
 
M

Michael Neumann

Am Dienstag, 14. April 2009 11:09:10 schrieb Charles Oliver Nutter:
http://robilad.livejournal.com/44589.html

I'm also running the BSD port of OpenJDK on Mac right now.

That's good news. They should have opened Java 10 years ago :)
I fear you need bootstraps to be able to compile that, which are
binaries, so again it's limited to some more widely used OSes. And this
will probably take hours to compile.
http://java-source.net/open-source/html-parsers

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

Thanks. I forgot to mention that the experience I made with Java lies
two years in the past :)

My point was, that while there are a lot libraries for Java, not all of
them are usable (the same applies to Ruby of course).
Btw, IIRC tagsoup somehow incorrectly converted UTF-16
(I forgot the exact details), so that in the end all umlauts were lost.

Regards,

Michael
 
M

Michael Neumann

Am Dienstag, 14. April 2009 12:51:11 schrieb Robert Dober:
Well so is the JVM, open source and run everywhere :).

Hehe, depends on what exactly JVM means. The machine
architecture? Or the emulator, which in case of Sun's JVM
is not open-source. OpenJDK seems to be open source, except a few binary
plugs ("Not all of the source code that makes up the JDK is available
under an open-source license") [1].

Run everywhere? Have you ever tried Java on DOS :). I remember running
Ruby under DOS :). Okay lets agree on run everywhere, where everywhere
means 95-99% of all machines.

Now, Ruby clearly runs more than everywhere, thanks to JRuby *g*.

Regards,

Michael

[1]: http://download.java.net/openjdk/jdk7/
 
M

Michael Neumann

Am Dienstag, 14. April 2009 15:00:06 schrieb Mark Thomas:
JRuby limited openssl loaded. gem install jruby-openssl for full
support.
Successfully installed hpricot-0.6.161-java
1 gem installed
Installing ri documentation for hpricot-0.6.161-java...
Installing RDoc documentation for hpricot-0.6.161-java...

Notice my use of "was", where "was" means Summer 2007 :)

And it's definitively great to be able to use hpricot on JRuby!

Regards,

Michael
 
R

Robert Dober

Let me get that straight, please:
Java can run everywhere (with the exception of DOS, sorry!!!)
but Ruby can run on more than everywhere, well I guess I will ponder
this for eternity and come back to you immediately after that.........
 
C

Charles Oliver Nutter

Michael said:
Hehe, depends on what exactly JVM means. The machine
architecture? Or the emulator, which in case of Sun's JVM
is not open-source. OpenJDK seems to be open source, except a few binary
plugs ("Not all of the source code that makes up the JDK is available
under an open-source license") [1].

I don't know what you mean by "emulator". OpenJDK *is* Sun's JVM, and
other than the parts Sun couldn't legally open-source (owned by other
companies) it's open-source. The "binary plugs" have also successfully
been replaced by OSS equivalents; see the IcedTea project from RedHat.

- Charlie
 
C

Charles Oliver Nutter

Michael said:
That's good news. They should have opened Java 10 years ago :)
I fear you need bootstraps to be able to compile that, which are
binaries, so again it's limited to some more widely used OSes. And this
will probably take hours to compile.

Whine whine whine :)

Took me less than an hour last time, and you can get JVM builds (based
on the same codebase) for building on all the BSDs already.

- Charlie
 
C

Charles Oliver Nutter

Eleanor said:
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.

I tend to agree here. Groovy really is Java with enhancements (lots of
enhancements, sure), and simply would cease to exist without being on
the JVM, having JVM's types, libraries, and type system, and without a
lot of Java's baggage. Groovy is, in a sense, a dynamic-typed Java. That
certainly gives an easy path for folks used to Java to start moving to
dynamic langauges. But detaching it from Java would not be easy, if it's
possible at all.

- Charlie
 
R

Robert Dober

I tend to agree here. Groovy really is Java with enhancements (lots of
enhancements, sure), and simply would cease to exist without being on the
JVM, having JVM's types, libraries, and type system, and without a lot of
Java's baggage. Groovy is, in a sense, a dynamic-typed Java. That certain= ly
gives an easy path for folks used to Java to start moving to dynamic
langauges. But detaching it from Java would not be easy, if it's possible= at
all.
I am amazed that you say that, do you not think it would be easier to
port Groovy to e.g. Ruby than Ruby to Java?
Ok it would be lots and lots of work but surely less than the JRuby
project. Well I have no idea if it will be worth it, but that is not
my question.
To be honest I am not worried about Groovy, but about Clojure, which I
find most interesting.

Cheers
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.
 
C

Charles Oliver Nutter

Robert said:
I am amazed that you say that, do you not think it would be easier to
port Groovy to e.g. Ruby than Ruby to Java?
Ok it would be lots and lots of work but surely less than the JRuby
project. Well I have no idea if it will be worth it, but that is not
my question.
To be honest I am not worried about Groovy, but about Clojure, which I
find most interesting.

I think the fact you're missing is that without the set of classes and
libraries on the Java platform, Groovy would be a shell of a language.
Moving Groovy off the JVM would mean you'd need to also port across all
Java classes that it needs to run, as well as annotations, generics, and
many other things that don't make much sense off-platform. I will
concede it's probably possible to do, but totally infeasible.

- Charlie
 
R

Robert Dober

I think the fact you're missing is that without the set of classes and
libraries on the Java platform, Groovy would be a shell of a language.
Moving Groovy off the JVM would mean you'd need to also port across all Java
classes that it needs to run, that I was aware of
as well as annotations, generics, and many
other things that don't make much sense off-platform. that I missed
I will concede it's
Thanx for explaining.
R.
 
M

Michael Neumann

Charles said:
Whine whine whine :)

Took me less than an hour last time, and you can get JVM builds (based
on the same codebase) for building on all the BSDs already.

Hehe, I will try that on my "super-fast" netbook running DragonFlyBSD :)

Regards,

Michael
 
M

Michael Neumann

Charles said:
Michael said:
Hehe, depends on what exactly JVM means. The machine
architecture? Or the emulator, which in case of Sun's JVM
is not open-source. OpenJDK seems to be open source, except a few binary
plugs ("Not all of the source code that makes up the JDK is available
under an open-source license") [1].

I don't know what you mean by "emulator".

If you treat JVM as an instruction set architecture (like IA32/x86), then
the concrete machine or machine emulator that runs this ISA. Don't know how
this is correctly termed in Java. JVM is probably the concrete machine, but
then, how is the ISA termed? And how would one call other JVM implementation
like Jikes? Jikes-JVM? Don't worry, I think this is getting off-topic :)

Regards,

Michael
 
M

Michael Bruschkewitz

Diego Virasoro said:
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).

Depends on your colleagues.
If you are in a Java environment and want to implement some scripting, then
it's probably better to start with Groovy.
If you are in an environment where not much people know _and_ _like_ Java,
start with Ruby.

For the long term, try to aquire both.

IMHO, Java is the language of choice for (portable) GUI-Apps if you don't
have the need for hardware-or OS-near programming.
(There are GUI-Libs for Ruby too, however, currently no IDE provides
possibilities for Ruby as some do for Java.)

Ruby is wonderful for scripting, with a broad range of capabilities.
You could use very advanced features, but you're able to start at a very low
level. Which is important when colleagues which are specialized on another
area should be able to modify your scripts.

Michael B.
 
M

marc

Michael Bruschkewitz said:
IMHO, Java is the language of choice for (portable) GUI-Apps if you
don't have the need for hardware-or OS-near programming. (There are
GUI-Libs for Ruby too, however, currently no IDE provides possibilities
for Ruby as some do for Java.)

Better still, use JRuby. All the advantages of Java (when you need it)
and all the bnefits of Ruby when you don't. (You can package and deploy
with rawr.)
Ruby is wonderful for scripting, with a broad range of capabilities. You
could use very advanced features, but you're able to start at a very low
level. Which is important when colleagues which are specialized on
another area should be able to modify your scripts.

As a Java dude, I got into Ruby precisely for its ease of use for
scripting. JRuby is the icing on the cake.
 
M

Michael Bruschkewitz

marc said:
Michael Bruschkewitz said:


Better still, use JRuby. All the advantages of Java (when you need it)
and all the bnefits of Ruby when you don't. (You can package and deploy
with rawr.)

That's what I discussed yesterday w/ Logan, rawr-Maintainer.
I did JRuby into Java integration in my last project.
But my colleagues already know Ruby.

My argument was:
If you're in an environment which is familiar to Java but not to Ruby, I
would prefer Groovy.
 
R

Robert Klemme

2009/6/5 Michael Bruschkewitz said:
My argument was:
If you're in an environment which is familiar to Java but not to Ruby, I
would prefer Groovy.

What are your reasons for this? Is it easier to access Java classes
from Groovy then from JRuby?

Kind regards

robert
 
M

marc

Michael Bruschkewitz said:
That's what I discussed yesterday w/ Logan, rawr-Maintainer. I did JRuby
into Java integration in my last project. But my colleagues already know
Ruby.

My argument was:
If you're in an environment which is familiar to Java but not to Ruby, I
would prefer Groovy.

Sure, the barrier to entry is lower. Also, as a manager type, I often
encounter devs who treat their day job as just that and are not
interested or motivated to learn more than they have to - they quietly
drive me nuts, to be honest! If this is the case, then Groovy is more
likely to succeed - and you won't encounter quiet hostility every day at
work!

If you have "old skool" devs who are interested in their work, then I'd
push on with JRuby (and by association Ruby). Ruby isn't "better",
necessarily, but it has features that allow you to do things a lot more
tersely than Java, which I'm sure we'll agree is rather a verbose
language, and I like that.

There's also an element of simply using and doing something different.
It's refreshing, invigorating, and I believe aids creativity.
 

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

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,734
Latest member
manin

Latest Threads

Top