The "ruby way" to do desktop applications?

Hello,

I use Ruby for web applications and I want to know what’s the best
practice for a desktop application. I know there is some libraries to
build desktop application like QTRuby but I don’t know if it’s as
powerful as Java’s libraries or C#.

So, what is the best practice to create a desktop application in the
Ruby Way? Should I really use Ruby? Is there a Rails like for desktop
applications? Is there some books on the subject?

Thanks!

I’ve built a few simple desktop apps using Ruby, Tk, and Ocra.
There are plenty of possibilities, but I assume that you want to pick
the best tools for the job by looking at your objectives. Without a bit
of detail about the kind of application you want to build and its
capabilities and portability, not to mention all the other priorities
you might have (load speed, code-writing speed, memory size, API usage
etc); it’ll be difficult to know what the best approach is.

For exemple, I want to create an application to manage a small business.
I want to store contacts, products and bills. I need a simple interface.
Nothing very complicated but I need a clean and pretty interface. I can
build it with Swing, in Java.

In this case which tool can I use? Is it better to build a local web
application?

One other option is shoes, which has been getting some updates recently.
But
still I have to agree that one of my major losses in moving all my
coding to
Ruby has been lack of good GUI tools. If I didn’t have to worry about
others, I
would use MacRuby and just use the APIs available to me there, but as
mentioned,
this doesn’t work well when scripts must run on both Windows, and Macs.

Wayne

Subject: Re: The “ruby way” to do desktop applications?
Date: mar 12 feb 13 12:29:45 +0900

Quoting guirec c. ([email protected]):

For exemple, I want to create an application to manage a small business.
I want to store contacts, products and bills. I need a simple interface.
Nothing very complicated but I need a clean and pretty interface. I can
build it with Swing, in Java.

In this case which tool can I use? Is it better to build a local web
application?

This is a bit of a weak point in Ruby. The GUI that has been included
in Ruby from the beginning is Tcl/TK. One tutorial is this:

Sadly, TK is a bit lame. It may be perfect for your application, but
it is far from flashy.

In the Linux world, two GUI libraries are mainly used: Gtk and
QT. About QT I can’t tell you much - it is in C++ and I do not like
its esthetics, so I always kept clear. I know there are bindings for
Ruby.

Gtk has bindings in Ruby. They are maintained almost single-handedly
by Kohei Sutou. He is a hero… Read more here:

I have used them for several projects. The learning curve is a bit
steep, but the results are quite professional-looking. The only
problem is that not too many people seem to adopt Gtk/Gnome
anymore. If you look for a marketable skill, the investment in time
may not prove too profitable.

If you want to use Jruby, I believe you can use Swing from Ruby
code. About that, too, I know nothing.

If you use Macs, I believe you can use Cocoa from Macruby. See
www.macruby.org.

There are other choices, from what I remember, but none seem to be
very popular.

Carlo

I’m thinking about that and I asked me : “Why is it useful to create a
desktop application?”. I think it’s useful when we need a good
performance and when we need to play with native components but, for
most of cases, a web application is a good solution.

When we need an basic application, like the one I gave in example, we
can host it on the cloud. It’s simpler and it increase the
maintenability. When we need to have applications which need to work
without the Internet, we can use a local storage tool. Today, things we
can do with javascript are incredible. We can do 2d and 3d drawing,
build animations, mobile application and a lot of things…

There is a lot of tools like Backbone, HTML5, CSS3, etc. which give a
great user experience. In addition, It’s easy to create a mobile
application, a web application and a locale application on the same
server. It’s easy to reuse the code and to share data.

So, can I put Java to the draft and create my application only with
standard web applications? I’m not sure. What do you think about that?

I want to build an application at least compatible with Windows.

I’m not sure about JRuby. Is it better to use JRuby or pure Java? I
think to use an alternative is a source of bugs.

About Shoes, it seems to be very simple. Is it possible to create trees,
panels and more advanced components?

To create a local web app can be more complexe because it must have a
web server.

For the moment, I think I will develop a desktop application with Java.

Shoes seems to be good. The demos than I seen seems to be a little bit
uggly.

Do you confirm than we can do everything than we can do with Swing?

What about performance? If I want to do a 3D application, it will be as
fast as in pure Java. (I know, Java is not very fast with 3D)?

What about html5/javascript/css3 applications in local or in the cloud?

guirec c. wrote in post #1096304:

… I want to create an application to manage a small business.
… I need a simple interface.
Nothing very complicated but I need a clean and pretty interface. I can
build it with Swing, in Java.

In this case which tool can I use? Is it better to build a local web
application?

Hi Guirec,

Shoes, Shoes, and Shoes… it’s dead simple, multi-platform, and uses
native widgets to look good. Shoes4 GitHub - shoes/shoes4: Shoes 4 : the next version of Shoes is
on the way, and uses Java and Swing (among other things) - so anything
you can do there you should be able to do with Shoes… only more in the
‘ruby-way’ :wink:

until Shoes4 is stable and released, you can check out the various
flavors of Shoes to see which is best for you. red shoes
http://shoesrb.com/ is the standard bearer - carried on from _why’s
amazing work. green shoes GitHub - ashbb/green_shoes: Green Shoes is one of the colorful Shoes written in pure Ruby. is
another popular variety - you can install it with a gem, and then make
apps that are packaged in gems (which require green_shoes.) if you’re
familiar with java, purple GitHub - ashbb/purple_shoes: Porting Green Shoes with JRuby and SWT or
brown GitHub - shoes/brown_shoes shoes might be your fit…

Shoes4 is largely based around the efforts of brown and purple shoes,
and if you have knowledge of Java with Swing and/or Swt you might be
able to help out making Shoes even better!

  • j

On Tuesday 12 February 2013 Carlo E. Prelz wrote

application?
QT. About QT I can’t tell you much - it is in C++ and I do not like
its esthetics, so I always kept clear. I know there are bindings for
Ruby.

I like Qt very much instead. The bindings are quite complete and there’s
a gem
for it called qtbindings. I’m not entirely sure about this, but I think
you
have to install the Qt library itself (http://qt-project.org/downloads,
mind
to download the 4.8 version not the 5.0 one), before installing the gem.

The only drawbacks of these bindings is that they keep a bit too much of
the
C++ approach and that there isn’t specific documentation for the ruby
version.
They closely follow the C++ API, though, so you can use that
(The Qt Project) as reference.

Stefano

Stefano C. wrote in post #1096380:

On Tuesday 12 February 2013 Carlo E. Prelz wrote
I like Qt very much instead. The bindings are quite complete and there’s
a gem for it called qtbindings.

I can also add a recommendation for QT. I did extensive work with it
under Python and had very few surprises; I’ve done a few small apps with
Ruby and QT and found it as easy to work with as under Python. It’s not
perfect but having played with some of the other options, found QT
somewhat more mature and capable.

I have had good success with jruby swing wrappers.

http://appjs.org/

what about qtruby?

+1 for Qt

I have been using FXRuby and GTk. I switched to Qt because it’s the only
framework which gives exactly the same look and feel on Windows and
OSX.

Once you get used to the “signal/slot” idiosyncrasy, it is quite simple
to work with. The ruby binding ‘qtbindings’ is transparent and the Qt
documentation is excellent. On the qtbindings’ site, you can find the
ruby translation of the Qt tutorials, which helps building the
translation experience.

On Windows, Qt is packed in the binary gem. Nothing to do except a gem
install.

Shoes is wonderful for simple things, but quite limited.

_md

I think I will use QtRuby. It seems to be very simple.

Somebody know if it’s as powerful as pure QT?

I’ve been using FXRuby too much, I’ve found 4 bugs in the way, only one
was resolved, the others remains in the bug tracker with no response,
this is because the project is unmaintained, Lars Kanis is supposed to
be in charge but he rarely response. The framework is very nice, I’ve
tested it only in Windows 7 64 bits and XP 32 bits. Supposedly works on
any OS, at least Linux and Windows…
Here’s the webpage: fxruby | RubyGems.org | your community gem host
FXRuby is a wrapper of the Fox C++ library. If you chose to pick this
one I can help you from the FXRuby Forum right here, I’m the only
writting there, feels lonely ^^.
Cheers.

Check out Glimmer! It’s all about the Ruby Way! Friendly DSL. Check! Smart defaults. Check! Automatic data binding. Check! TDD support. Check! Scaffolding. Check! Native executable packaging. Check! It was presented originally at RubyConf 2008 and approved as an official Eclipse project before it split off and went on its own. It’s featured in the O’Reilly book JRuby Cookbook.