views:

159

answers:

2

This is actually two questions rolled into one.

  1. Is there a particular type of Java functionality that people are using JRuby for or is it mainly because of the performance advantage that JRuby gives versus the MRI?

The reason I ask is, I'd like to add some Java functionality to a Rails project (just to show that it's possible). Ideally this Java functionality would also be useful rather than redundant. Which leads to my next question . . .

  1. What's an example of something that would make a good demonstration of Java functionality being added to a simple Rails CRUD app?

I guess anything you can do in a Ruby class, you could just as easily do in a Java class (with about twice as much code), so I understand the question may be hard to answer. I'm just wondering if there is a particular type of functionality that is more appropriate to do in Java.

There's nothing at stake here, by the way. I'm just playing around and testing things out.

+2  A: 

I'd find a focused Java library that fills an existing need in Java and work on leveraging that library within your rails application. One possibility is to use JTS (Java Topology Suite) to manipulate geographic regions in a rails app and convert them for display on a map within your rails app.

Alex B
A: 

I think the Ruby class libs (gems) can do pretty much anything the Java libs can do, so there's not much of a compelling reason to use JRuby on Rails in a "stand-alone" scenario.

I use it to integrate with a vendor Java app. Knocking up a quick controller and some views is much easier than extending using Java/Swing.

Also in a "Enterprise" environment, a rails developer may be obliged to deploy to Tomcat or Glassfish. The Warbler gem for JRuby enables this.

Rob