views:

1207

answers:

7

I'm about to start a project developing a Ruby desktop application. I expect to to be fairly big and I want to learn techniques for dividing code among modules and other techniques for managing complexity. Most large apps I've looked at are Rails apps, but these aren't very helpful, because most of the work is done by Rails itself.

What source code would you recommend I take a look at? I'm not interested in libraries or Rails apps, because I get how they do things. CLI apps are OK, but I'm mostly interested in GUI apps (I'm using Gtk+, but I can learn just as much from apps using other GUI toolkits).

+1  A: 

Maybe check out FxRuby (a ruby gui library wrapper) to see if that turns up any leads.

You could certainly apply the same organizational principles used for Rails apps and apply them to a desktop app. The Griffon framework (a java Swing framework) basically did that for Grails (essentially a java Rails clone).

Ken Liu
Yeah, the great thing about Rails is you really don't have to think to do it (I know that's an exaggeration). Just put your code where Rails expects and everything works out. Rails basically handles the complexity and modularity. Maybe I should develop a framework to wrap my app around...
Mark A. Nicolosi
Rails itself wasn't exactly developed as a framework — it was extracted from Basecamp. So I would say that if you design your app well, you will have the start of a good framework.
Chuck
+5  A: 

The FreeBASE plugin manager system is designed as a way to organize code in GUI applications, and it has worked well for me in my development of Redcar, a Ruby/Gtk text editor.

FreeBASE is nothing to do with the online open database project Freebase, it is something that the FreeRIDE Ruby IDE people developed to make it easier for them to structure a large GUI project.

So FreeBASE is part of FreeRIDE, but also works separately. You can find information about it here.

Daniel Lucraft
I've actually been reading quite a bit of Redcar's source code for inspiration (pretty cool, but I'm a Vim guy). I'll checkout FreeBASE. Thanks Daniel and keep up the awesome work on Redcar, maybe one day I'll convert ;)
Mark A. Nicolosi
+1  A: 

Heard about JotBot earlier, haven't tried it yet, though.

MonkeyBars also comes to mind, when talking about MVC frameworks for desktop (J)Ruby.

inger
+3  A: 

Check out LimeChat, which is a graphical irc client written in Ruby(Cocoa). Its source code is available on github.

whaley
A: 

Google SketchUp has a Ruby API.

StackedCrooked
+1  A: 

(At the risk of downvotes)

Ruby is my primary language, and would I advise against coding a large desktop application in Ruby, unless the bulk of the code is already written and simply needs a new GUI frontend developed quickly. IMHO, you're in for a world of pain. CRuby isn't the best tool for this job, as it's weak in some areas that are critical for desktop applications e.g. threading, non-blocking IO, 1st class GUI toolkit support, etc...

JRuby or IronRuby are a different stories, though...

John Douthat
yeah anything besides jruby pretty much scares me in terms of cross platform portability...if you just wanted to target one platform then it might work.
rogerdpack
ahh, and RedCar, mentioned in Daniel Lucraft's comment, may have come to the same conclusion; They made the switch to JRuby. Indeed, it's Daniel's own editor ;)
John Douthat
+4  A: 

I'm the owner of JotBot, a desktop app for tracking time. It was built using Monkeybars, with JRuby + Swing. It's an extremely robust tool set for cross-platform desktop applications. There is the downside that the use of Swing may interfere with achieving a true native look for any particular desktop, but other than that it is a real win. Plus, using Rawr, you can easily create bundled applications and installers for OSX, Windows, and Ubuntu.

Drop me a line if you have any questions: [email protected]