11 Comments

Desktop Application Development in JRuby

Is JRuby a realistic candidate for authoring complex desktop applications?

Yes.

UPDATE (Jan. 30, 2009): Our client has cleared us to spill our guts on the details of the project discussed here now that it’s complete… Ruby for Desktop Applications? Yes we can.

Last spring Karlin Fox and I became involved with a project that aimed to rewrite an old DOS app as a modern desktop app. Once Java was selected as our platform we immediately began to consider if JRuby could play a role in the project. We discussed several levels of JRuby usage. We had applied JRuby in the past for testing and various tool-smithing tasks, but we wanted to see JRuby play a larger role. The decision was made to write as much of the application as possible in Ruby.

We are now in the 22nd week of the project and there have been no regrets with our decision to use JRuby. It continues to excite me that I get to use my favorite programming language to test and create an attractive desktop application. Micah Alles joined the project in the 10th week increasing the team to three members. The code is now being exercised by 793 RSpec examples at the unit level and 73 integration examples that exercise the app just below the GUI. The application has reached a size of 187 classes which contribute to 7,890 lines of code.

The application is a simulation that shows a two dimensional topological view of connected nodes that the user gets to interact with. Users can load different topologies into the application. Data is gathered while the simulation runs and the user has the ability to view various reports about their performance.

We are using the Batik SVG Toolkit to render the topology. The rendered SVG is interactive. Clicking on components brings up swing dialogs. Using SVG gave us the ability to easily integrate artwork created by the design team.

Using Swing components through JRuby has been much easier than with straight Java. We have built several complicated widgets using complex components like JTable. For layout purposes we have used Cheri::Swing, Profligacy, translated output from the Netbeans GUI designer, and rolled some views by hand. Our only setbacks have been the slow progress of Java integration features in JRuby and the lack of a comprehensive Swing layout manager.

We are bundling all of the application’s Ruby code, Ruby and Java dependencies, and JRuby itself into a single executable jar which we deliver weekly at the end of each iteration. Our target OS is Windows, but we all develop on OS X and Linux as well.

We should be able to provide some screen shots by springtime when the application is officially released, and will post anything noteworthy during the rest of our development effort. Please share any JRuby success stories you have with us and be sure to post them on the JRuby wiki.
Thank you JRuby team!