Ruby & Java vs JRuby

My team has been doing Java for a long time. We are switching to Ruby.
We are finding that Ruby has limitations and that we have to do certain
things in Java. I’m trying to find a way to call Java code from Ruby.
I’m searching Google and such, and I always end up on a page describing
how to call Java code from JRuby. That’s not what I want.

Then I start to wonder why we’re NOT using JRuby?! Instinctively, I’m
thinking Java and Ruby is what we’re doing. JRuby is the best of both
worlds. What am I missing?

I’ve asked around a little bit and I’ve heard a few negative things
about JRuby, such as memory issues or diminishing oracle/community
support, or whatever. Is JRuby a dud? Or is it viable for real-world,
large-scale, mission critical apps, the way Ruby/Rails supposedly is? Is
there a reason that we should be coding in Ruby AND Java instead of just
going with JRuby? Can we not use Rails if we do JRuby? I mean, why
wouldn’t you want access to all the comprehensive features in Java,
combined with the ease/fun of Ruby?!

Thoughts?

On Oct 24, 2012, at 13:15 , Will B. [email protected] wrote:

My team has been doing Java for a long time. We are switching to Ruby.
We are finding that Ruby has limitations and that we have to do certain
things in Java.

I’m not going to address the jruby side as I don’t use it…

Maybe you could address this from a different perspective. What
limitations are you finding?

Excerpts from Will B.'s message of Wed Oct 24 22:15:40 +0200 2012:

We are finding that Ruby has limitations and that we have to do certain
things in Java.
If you only evaluate Ruby vs Java you missed Scala. So your comparison
is not serious.

If you’re writing to a ruby mailinglist people may tell you about
additional ways to get those things done if you talk about them.
Maybe it dosen’t make sense in your case.

I never used JRuby. I just add some of my “thoughts”.

Marc W.

On 10/25/2012 09:15 AM, Will B. wrote:

Is JRuby a dud? Or is it viable for real-world,
large-scale, mission critical apps, the way Ruby/Rails supposedly is?
I have no clue whatsoever about rails, but we have had jruby based
‘mission critical’, ‘real-world’, and ‘large-scale’ applications running
at work for over a year. What is your definition of dud?

Sam

On Wed, Oct 24, 2012 at 3:15 PM, Will B. [email protected]
wrote:

My team has been doing Java for a long time. We are switching to Ruby.
We are finding that Ruby has limitations and that we have to do certain
things in Java. I’m trying to find a way to call Java code from Ruby.
I’m searching Google and such, and I always end up on a page describing
how to call Java code from JRuby. That’s not what I want.

What are the limitations which you are referring to.

Then I start to wonder why we’re NOT using JRuby?! Instinctively, I’m
thinking Java and Ruby is what we’re doing. JRuby is the best of both
worlds. What am I missing?

For the most part it depends on what your task is.

Thoughts?

jruby is not a dud (whatever that means)… It’s used in the “real
world” the same as ree and mri (et al)

Rails runs on jruby. Why would you think it doesn’t? Rails is just a
program written in ruby.

And since you asked:

Personally I don’t want the “comprehensive features in Java”. But that
doesn’t mean that you don’t. What I want (which I have) is the
comprehensive syntax inspired from SmallTalk with the eloquence and
simplicity of the UNIX shell with the programmable programming
language of Lisp.

Either way. Without explaining what the actual issue your having with
(outside of your google rumors) no one here will be able to help with
your specific edge case. Hit up the jruby people and have them help
you with creating wrappers for the cargo of “missing features from
java” for your application stack.

Hi Will,

You might have been better of asking this question on a JRuby mailing
list (http://xircles.codehaus.org/projects/jruby/lists) as this list
seems to be very MRI focused mostly :wink:

That said it sounds to me JRuby would be your natural ally. I’ve found
the cross over from Ruby to Java elegant and far more easy to use than
building C-extensions for MRI.
It also allows for true multi threading in Ruby (without a GVL) and
generally peforms quite admirably compared to MRI.

Because of the abominable startup time (one of the few downsides of
JRuby) I do not normally use it for small scripts/tools but for large(r)
scale applications that does not really matter.

I’ve run a Redmine/Rails webapp on JRuby/Glassfish for years with great
satisfaction.

regards,
Martin.

I will repeat what others have said already but I thought
the reinforcement would be worthwhile.

On Wed, Oct 24, 2012 at 10:15 PM, Will B. [email protected]
wrote:

My team has been doing Java for a long time. We are switching to Ruby.
We are finding that Ruby has limitations and that we have to do certain
things in Java. I’m trying to find a way to call Java code from Ruby.
I’m searching Google and such, and I always end up on a page describing
how to call Java code from JRuby. That’s not what I want.

Why?

Then I start to wonder why we’re NOT using JRuby?! Instinctively, I’m
thinking Java and Ruby is what we’re doing. JRuby is the best of both
worlds. What am I missing?

JRuby. :slight_smile:

I’ve asked around a little bit and I’ve heard a few negative things
about JRuby, such as memory issues or diminishing oracle/community
support, or whatever. Is JRuby a dud? Or is it viable for real-world,
large-scale, mission critical apps, the way Ruby/Rails supposedly is? Is
there a reason that we should be coding in Ruby AND Java instead of just
going with JRuby?

One possible case where you need to write Java code: you might want to
use Java libraries which do not work nicely with the (J)Ruby way and
have to create glue code.

Other than that some “low level” things might be more efficiently done
in Java.

A different option is to use a Java framework (e.g. JEE) and use JRuby
callouts to customize business logic.

Thoughts?

Go for JRuby - at least give it a try.

Kind regards

robert

Full disclosure…I have a hand in JRuby.

On Wed, Oct 24, 2012 at 3:15 PM, Will B. [email protected]
wrote:

Then I start to wonder why we’re NOT using JRuby?! Instinctively, I’m
thinking Java and Ruby is what we’re doing. JRuby is the best of both
worlds. What am I missing?

That’s my question too…because I want to fill in any information
gaps that keep people from choosing to use JRuby :slight_smile:

I’ve asked around a little bit and I’ve heard a few negative things
about JRuby, such as memory issues

JRuby does use more memory than MRI for small applications. For any
large applications, however, it can often use far less memory than
MRI. And you can do everything out of one process, where with MRI you
might need several…so there’s savings that way too.

or diminishing oracle/community
support

I have been skeptical of the Oracle takeover of Java too…but nothing
so far has warranted my fears. They continue to run the project in the
open, progressively opening more up in the process, and their
priorities for Java and the JVM seem in line with what people want
(including language devs like me). I’m not worried about the future of
the JVM or the community that surrounds it (for now).

Is JRuby a dud?

I don’t think so, but I’m biased :slight_smile:

Or is it viable for real-world,
large-scale, mission critical apps

There are several companies running JRuby for core parts of their
operations. Some companies run everything on JRuby. Others would not
have a product without JRuby. It’s viable.

the way Ruby/Rails supposedly is?

We’ll never be perfect, but where we lag behind some aspects of MRI,
we exceed it in others. If “Ruby” and “Rails” can be viable for
mission-critical apps, then JRuby certainly is as well…and if
anything stands in the way of that I want to know about it :slight_smile:

Is
there a reason that we should be coding in Ruby AND Java instead of just
going with JRuby?

If a large part of your existing system revolves around irreplaceable
C extensions, or you simple need to use MRI for some other reason,
then using RJB (Ruby-Java Bridge) to call a little bit of Java would
be better. JRuby is designed to mostly drop in, but it’s not a trivial
move either. We recommend people choose JRuby who really need
JRuby…if that’s you, we’ll work very hard to make sure your
experience goes well.

Can we not use Rails if we do JRuby?

Rails runs just fine, and has become better acquainted with JRuby over
the years.

I mean, why
wouldn’t you want access to all the comprehensive features in Java,
combined with the ease/fun of Ruby?!

Indeed! And that’s exactly what JRuby intends to be…a drop-in
replacement for regular Ruby for all apps that make sense, but also a
first-class citizen of the JVM with all rights therein. I think we’re
doing a pretty good job of delivering that.

  • Charlie