Ruby vs. Groovy: your perspective

On Tue, Apr 14, 2009 at 12:36 PM, Eleanor McHugh
[email protected] wrote:

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.

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

On Apr 14, 4:21 am, Michael N. [email protected] wrote:

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…

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 (Turing completeness - Wikipedia
). Thus, they are literally capable of the same things.

Mmm… that sounds a lot like fine semantic details. :confused:
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

Am Dienstag, 14. April 2009 12:51:11 schrieb Robert D.:

On Tue, Apr 14, 2009 at 10:23 AM, Michael N. [email protected]
wrote:

coupled to the JVM?

Ruby is open-source. Ruby runs everywhere.

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

Am Dienstag, 14. April 2009 15:00:06 schrieb Mark T.:

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 :slight_smile:

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

Regards,

Michael

Am Dienstag, 14. April 2009 11:09:10 schrieb Charles Oliver N.:

Log in

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 :slight_smile:
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.

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 :slight_smile:

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

Michael N. wrote:

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

On Tue, Apr 14, 2009 at 3:43 PM, Michael N. [email protected]
wrote:
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…

Michael N. wrote:

That’s good news. They should have opened Java 10 years ago :slight_smile:
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 :slight_smile:

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

Eleanor McHugh wrote:

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

On Tue, Apr 14, 2009 at 7:41 PM, Charles Oliver N.
[email protected] wrote:

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.

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


Si tu veux construire un bateau …
Ne rassemble pas des hommes pour aller chercher du bois, préparer des
outils, répartir les tâches, alléger le travail… mais enseigne aux
gens la nostalgie de l’infini de la mer.

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

On Tue, Apr 14, 2009 at 9:00 PM, Charles Oliver N.
[email protected] wrote:

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.

Robert D. wrote:

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

Charles Oliver N. wrote:

Michael N. wrote:

That’s good news. They should have opened Java 10 years ago :slight_smile:
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 :slight_smile:

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 :slight_smile:

Regards,

Michael

Charles Oliver N. wrote:

Michael N. wrote:

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 :slight_smile:

Regards,

Michael

“Diego V.” [email protected] schrieb im Newsbeitrag
news:[email protected]

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.

“marc” [email protected] schrieb im Newsbeitrag
news:[email protected]

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

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.

2009/6/5 Michael Bruschkewitz
[email protected]:

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

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.


Best,
Marc

“Change requires small steps.”