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.


<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


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