Ruby for Desktop Applications? Yes we can.

Just today someone told us he heard you can’t do real development in Ruby. Funny – the AGI Goldratt Institute paid us a whole bunch of money for nothing then. It must be that their brand new, multi-platform, JRuby-based desktop simulation app doesn’t exist. Pity.

Backstory

<corporate speak>AGI provides Theory of Constraints consulting and training to organizations pursuing rapid and sustained bottom line improvement</corporate speak>. They’ve been fantastic to work with, and they help their clients achieve impressive results. AGI uses several pieces of software in their training sessions to simulate manufacturing and supply chain scenarios. They’re reminiscent of old skool games. These original applications were developed for DOS in the early 90s. As time went on the simulators presented a number of pain points motivating AGI to contract out new software development – that’s where we came in.

How We Did It

We love Ruby and how much can be accomplished in a short time with it. With JRuby and 12-ish months we created for AGI a complex desktop application, Production Simulator, able to run on Windows, Mac, and Linux. The awesomeness here is that JRuby let us use a preferred language, Ruby, together with a bunch of really mature Java libraries, technologies, and tools that might not otherwise be available to Ruby. And, in the end, thanks to Java we got multi-platform support almost for free.

The application is multi-threaded to decouple simulation execution, graphical updates, and user interaction. Heavy lifting in the simulation doesn’t decrease the application’s responsiveness to the user; updating the interface doesn’t slow down the core simulation. Under the hood, simulation execution has certain similarities to a gaming engine.

  • Our normal practices ran the show – stories, iterations, whole team, burn-down charts, TDD, continuous integration, etc.
  • RSpec runs 2120 Unit tests + 286 Integration tests
  • Atomic Object libraries Hardmock, Constructor, & DIY enabled our testing and construction patterns
  • Copious use of Presenter First allowed GUI stories to be fashioned into tested code
  • Substance skins the app
  • Batik creates an SVG canvas upon which the simulation screen itself is drawn
  • Bouncy Castle encrypts the license keys and simulation files
  • YAML specifies production facility layouts, resources, and parameters
  • Two Java jars package up the whole app (one for app + libraries; another for Bouncy Castle lib due to technical complication)
  • NSIS handles installation in Windows
  • IzPack handles installation in Mac & Linux (in process of replacing with native Mac installer now)
  • Launch4J handles launching the app in Windows
  • IzPack handles launching the app in OSX
  • A shell script handles launching the app in Linux

Incidental Goodies

Because of our exposure to AGI we came across the book Agile Management for Software Engineering: Applying the Theory of Constraints for Business Results. It concerns itself with using the Theory of Constraints to explain the effectiveness of the practices we use. Interesting read.

Demo Movie

Screenshots

Note: the new app’s cropped shots here link to big beautiful full images

New Production Simulator's chrome, simulation area, & widgets

New Production Simulator’s chrome, simulation area, & widgets (full image)

New Production Simulator's Buffer Management interface

New Production Simulator’s Buffer Management interface (full image)

Original DOS-based application

Original DOS-based application

 

Conversation
  • mark says:

    Man… the DOS version beats the rest so easily…

    Haha just kidding :-)

    I still got a weak spot in my heart for DOS though.

    Anyway, that’s so long ago – go ruby, go!

  • Rafael Rosa Fu says:

    Wow!!! I’ve used the DOS simulator at college, was a lot of fun but very old and ugly :) Never been so happy to see it again :) Nice job.

    Cheers,
    Rafael.

  • Ronald Suwandi says:

    It’s awesome.. This is the first time I saw a real ruby-based desktop application. Cheers =)

  • Looks good.

    I’m currently developing a JRuby desktop app that uses swing and I am concerned about the high memory consumption of my app. It’s about 300M with JRuby, activerecord, a mildly complex swing view and some additional libraries.
    Did you experience similar problems and did you solve them (or just told the client to get more mem? :-)

  • Martin:

    We set the initial and max heap size to 512 mb. We have not had a problem with memory consumption going beyond this limit.

  • […] one of our customers asked us to create a small, single-purpose tool to help support one of our JRuby desktop applications. The requirement was simple: make it easy to input minimum, maximum, and beta values into a beta […]

  • […] Swing testing. We’ve been using a combination of FEST and Ruby helpers specific to our own Swing applications. As Demetrius notes, Swing tests can be frustratingly brittle, but they are still well worth the […]

  • […] actors find humble shoes can teach them lessons From Cinderella ‘s glass slippers to the ruby red shoes worn by Dorothy in Oz, footwear only rarely The Thin Red Line – Trailer – […]

  • […] first engaged Atomic as a customer, trying to build a sizable software product. But I had no clue how to apply critical chain to the new environment of programming pairs, […]

  • Comments are closed.