views:

407

answers:

1

Has anyone tried mixing JavaFx and JRuby? I've built a desktop JRuby application with a Swing GUI (100% JRuby) and I'm toying with the idea of replacing the GUI with JavaFx for a more slick feel.

To fit with my current application I want to implement an MVC pattern with the View being JavaFX and the Controller and Model being Ruby.

+1  A: 

As far as conceptual differences between JavaFX Script,and J Ruby, there are quite a few. I'll start with JRuby. JRuby is not actually a language, per se. It is instead an implementation in Java of the Ruby programming language. The original runtime interpreter for Ruby was written in C (and perhaps some in C++, I'm not sure). The JRuby project was started by some guys who wanted a runtime implementation of Ruby that was written in Java instead.

Why? Well, there are some interesting advantages. First of all, they were able to make it very easy to invoke Java code from a Ruby application. Secondly, it means that Ruby programs end up being run by the Java Virtual Machine (JVM) and therefore can benefit from all the optimization work that has been done on JVMs over the last ten years. Today JRuby functions as an interpreter only, but from what I heard from one of the project leads earlier this month, they are very close to being able to compile Ruby programs directly into JVM bytecode, which would provide another performance boost.

In the end, JRuby is very interesting for projects that are written in Ruby but that want to leverage either: existing Java libraries or existing Java runtimes (the JVM and even application/web servers like GlassFish and Tomcat) or both.

JavaFX on the other hand is scripting language which is directly injected for creating graphics kind of stuff.Very pragmatic too.So coming to usage when you are following a design pattern in this case MVC if you are following the rules it should be fine.But trust there might be very few cases which may started using FX with JRuby.

GustlyWind