Ruby vs. Groovy: your perspective

Charles Oliver Nutter wrote:
> Eleanor McHugh wrote:
>> 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 :slight_smile:

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

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

···

On Tue, 14 Apr 2009 16:34:45 +0900 James Britt <james.britt@gmail.com> wrote:

Charles Oliver Nutter wrote:

Eleanor McHugh wrote:

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

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

···

On 14 Apr 2009, at 08:34, James Britt wrote:
----
raise ArgumentError unless @reality.responds_to? :reason

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

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

Kind regards

robert

···

2009/6/5 Michael Bruschkewitz <brusch4_removeunderlinesandtextbetween_@gmx.net>:

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

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Michael Bruschkewitz said:

"marc" <gmane@auxbuss.com> schrieb im Newsbeitrag
news:h0akoq$eti$2@ger.gmane.org...

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.

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.

···

--
Best,
Marc

"Change requires small steps."

Ruby is open-source. Ruby runs everywhere.

Regards,

  Michael

···

On Tue, 14 Apr 2009 17:11:58 +0900 Albert Schlef <albertschlef@gmail.com> wrote:

Eleanor McHugh wrote:
> 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?

Michael Neumann wrote:

Portability is very subjective :slight_smile:
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 :slight_smile:

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

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

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

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

- Charlie

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.

···

On Tue, Apr 14, 2009 at 12:36 PM, Eleanor McHugh <eleanor@games-with-brains.com> wrote:

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.

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

···

On Apr 14, 4:21 am, Michael Neumann <mneum...@ntecs.de> wrote:

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

"marc" <gmane@auxbuss.com> schrieb im Newsbeitrag news:h0b1jf$pm3$1@ger.gmane.org...

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.

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!

Hello Marc,
your arguments target "devs" - I suppose you mean "software developers".
But you don't know which is the environment of OP.
Imagine, he develops software for medical devices, for example. Most probably, people in his environment would be highly specialized biologists, physicists, physicians a.s.o. which only accidentally do something related to software. Maybe adapting some parameters. Forcing them to learn another language just because it's "better" some way would be wasting resources.
Imagine space, car, rail, weapons, energy related projects - everywhere you will work with people which are highly specialized on their area. In most real-world projects, you will have tight deadlines. So, low entry barriers are important for the success of most projects.
That's for short term.

For long term I supposed both languages for reasons as you mentioned below.

Unfortunately, OP did not tell about his needs or environment.

If you have "old skool" devs who are interested in their work, then I'd
push on with JRuby (and by association Ruby).

It always depends on (their) plans for future. And depends on how much time is needed or available until targets must be reached.

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.

No doubt.

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

···

On Tue, Apr 14, 2009 at 10:23 AM, Michael Neumann <mneumann@ntecs.de> wrote:

On Tue, 14 Apr 2009 17:11:58 +0900 > Albert Schlef <albertschlef@gmail.com> wrote:

Eleanor McHugh wrote:
> 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?

Ruby is open-source. Ruby runs everywhere.

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

--
Antoine de Saint-Exupéry

Michael Neumann wrote:
> Portability is very subjective :slight_smile:
> 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 :slight_smile:

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.

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

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

···

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

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 15:00:06 schrieb Mark Thomas:

On Apr 14, 4:21 am, Michael Neumann <mneum...@ntecs.de> 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...

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

···

On Tue, Apr 14, 2009 at 7:41 PM, Charles Oliver Nutter <charles.nutter@sun.com> wrote:

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.

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

--
Antoine de Saint-Exupéry

Michael Bruschkewitz said:

"marc" <gmane@auxbuss.com> schrieb im Newsbeitrag
news:h0b1jf$pm3$1@ger.gmane.org...

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.

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!

Hello Marc,
your arguments target "devs" - I suppose you mean "software developers".
But you don't know which is the environment of OP.

Sure, the OP was looking for subjective views, and they can only be based
on the limited info provided; I wasn't writing a thesis!

Imagine, he develops
software for medical devices, for example. Most probably, people in his
environment would be highly specialized biologists, physicists,
physicians a.s.o. which only accidentally do something related to
software. Maybe adapting some parameters. Forcing them to learn another
language just because it's "better" some way would be wasting resources.

No-one suggested forcing anyone to do anything; that is almost certainly
guaranteed to fail. But I certainly don't agree that devs learning a new
language (identified as appropriate) is a waste of resources; a bean
counter might, but not an experienced technologist.

Imagine space, car, rail, weapons, energy related projects - everywhere
you will work with people which are highly specialized on their area. In
most real-world projects, you will have tight deadlines. So, low entry
barriers are important for the success of most projects. That's for
short term.

For long term I supposed both languages for reasons as you mentioned
below.

Unfortunately, OP did not tell about his needs or environment.

If you have "old skool" devs who are interested in their work, then I'd
push on with JRuby (and by association Ruby).

It always depends on (their) plans for future. And depends on how much
time is needed or available until targets must be reached.

Sure, it always depends. That's the nature of systems with constraints.

···

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.

No doubt.

--
Best,
Marc

"Change requires small steps."

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/

···

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

On Tue, Apr 14, 2009 at 10:23 AM, Michael Neumann <mneumann@ntecs.de> wrote:
> On Tue, 14 Apr 2009 17:11:58 +0900 > > > > Albert Schlef <albertschlef@gmail.com> wrote:
>> Eleanor McHugh wrote:
>> > 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?
>
> Ruby is open-source. Ruby runs everywhere.

Well so is the JVM, open source and run everywhere :).

Michael Neumann 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

Robert Dober 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

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

···

On Tue, Apr 14, 2009 at 3:43 PM, Michael Neumann <mneumann@ntecs.de> wrote: