Choosing between Ruby/Tk or Java Swing


Java Swing code

UPDATE: Alex has suggested I try Ruby with Qt. Genius!

My family has always had an obsession with the Monopoly board game, and since my mum died the remaining Schade clan has clung onto it even more as a family tradition. Because I have some spare time over the holidays I thought I'd create a computer version of Monopoly but with the place names and chance cards to do with places and experiences we've been to and had. Trouble is, I'm not sure what graphical toolkit and language to use!

The problem is we'll (hopefully) be taking this game to Europe, but our laptops have a smattering of different operating systems and configurations. My sister has a MacBook with Snow Leopard, I have a MacBook Pro with Snow Leopard and FreeBSD, and my dad is still forced to use Windows on his work laptop. Ideally I'd like to have my crappy little game being able to run on each.

Tickle Ruby with Tk or be the King of Java Swing?

Given I've been dabbling in Ruby again and have relearned the joys of Smalltalk like blocks, my first choice was to use Ruby with Tk because its fast to develop, seems to be relatively simple and comes with the default Ruby environment without installing anything extra, but I have far more experience with Swing in Java. As with everything in Java (and with me, ha!) its incredibly verbose to do even simple things, but its not terribly complicated unless you desperately want to do it the "correct" OOP way.

Judge me if you will, but for some reason I also really, really like the Metal Java Swing interface. Some people avoid it like the plague and allow their Swing applications to resemble the host operating system, but I reckon it looks classy.

Example Java Swing window with metal interface

I suppose I could come right out of left field and use JRuby with Swing, that way I have the familiar widgets and layout engines I'm [relatively] used to with a quicker to develop, RAD and Agile friendly language. Perhaps I'm getting a bit too ahead of myself though, would it be easier just to stick with Java on this one? Object serialisation (which I know how to do in Java but not Ruby) would make it great for saving and loading existing games too. Then again, perhaps I should force myself to branch into something new to learn something different.

Looks like I won't be deciding tonight!

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.