CSC/ECE 517 Fall 2010/ch1 S10 GP

From Expertiza_Wiki
Revision as of 08:07, 8 September 2010 by Gbchidam (talk | contribs)
Jump to navigation Jump to search

GUI Toolkits for Ruby

Traditionally, Ruby is a command line tool. Most Ruby commands are entered as text in a terminal and provide output to the user in the text form. Actually, the Ruby interpretor is not bound to any program development environment. Ruby programs can be typed in any editor and there are a lot of libraries to provide Graphical User Interface (GUI). This article discusses various GUI toolkits for Ruby.

Toolkits

Standard Inbuilt Toolkit library

The 'Tk' library is provided along with the standard Ruby distribution. Tk is an open source, platform independent toolkit. It is well-suited for cross-platform application development. Tk provides a number of widgets commonly needed to develop desktop applications such as button, menu, canvas, text, frame, label etc.

Tk is perfectly functional and easily available. Bindings are built-in to some ruby distros. Tk is easily customizable and configurable Tk does not support native widgets, it is ugly looking and the code also looks ugly.

Thirdparty Toolkits

There are a lot number of toolkit libraries for Ruby provided by third-party vendors. Mostly these are wrappers around toolkits written in C and C++. Many of these toolkits may not support cross-platform application development. Some of the thirdparty toolkits are FxRuby, wxRuby, ruby-GNOME2, etc.

wxRuby is an open-source GUI toolkit for Ruby. WxRuby is a Ruby binding and wrapper for the WxWidgets C++ classes. It allows you to use all the features of WxWidgets from your Ruby programs. You'll gain all of the benefits, including native look and feel, without having to touch any native APIs and without having to use another language at all.


Ruby Exclusive Toolkit

Shoes is a library implemented exclusively for Ruby. It is one of the most popular toolkits for Ruby.

Environment Specific Libraries

Recent Ruby implementations have their own GUI facilities provided by toolkits associated with the environment. Some of them are Cocoa for MacRuby and Swing for JRuby.

Comparison of Toolkits

Selecting the appropriate Toolkit

No single toolkit can be considered the best among available toolkits for Ruby. Users should select an appropriate toolkit based on their own requirements.

The following are some of the parameters that can be considered before choosing a toolkit.

  • Web-based documentation
  • Availability for relevant platforms
  • Appearance / aesthetics
  • Licence compatible with open source use
  • Range of features / widgets
  • Community support
  • Speed / performance
  • Internationalisation support
  • Licence compatible with commercial use
  • Accessibility features

Conclusion