CSC/ECE 517 Spring 2013/ch1a c ct: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
__TOC__
__TOC__


== Introduction ==  
= Introduction =
[https://docs.google.com/a/ncsu.edu/document/d/1czn14Zpte-kVHdcb5BUIkpI6wRcABH246jGCg9vncQA/edit#heading=h.8hxo5kudhpn2 Topic Writeup]
[https://docs.google.com/a/ncsu.edu/document/d/1czn14Zpte-kVHdcb5BUIkpI6wRcABH246jGCg9vncQA/edit#heading=h.8hxo5kudhpn2 Topic Writeup]


Ruby as a programming language has gained popularity in recent years (mainly due to the Rails web framework). There exists quite a few graphical user interface toolkits/frameworks for Ruby so that desktop GUI applications can be created. Most are simply bindings to existing GUI framework API's like Qt and GTK+, so they may seem awkward and unfitting to the Ruby language's style. Shoes, on the other hand, is written for Ruby specifically. Two previous articles have made detailed comparisons between different toolkits by looking at various factors such as ease of installation, documentation, look and feel, and difficulty of usage.[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_PH][http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_MM] This article will give updates on GUI toolkits that has developed since the previous articles were written, as well as discuss other toolkits that were not present in the previous articles.
Ruby as a programming language has gained popularity in recent years (mainly due to the Rails web framework). There exists quite a few graphical user interface toolkits/frameworks for Ruby so that desktop GUI applications can be created. Most are simply bindings to existing GUI framework API's like Qt and GTK+, so they may seem awkward and unfitting to the Ruby language's style. Shoes, on the other hand, is written for Ruby specifically. Two previous articles have made detailed comparisons between different toolkits by looking at various factors such as ease of installation, documentation, look and feel, and difficulty of usage.[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_PH][http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_MM] This article will give updates on GUI toolkits that has developed since the previous articles were written, as well as discuss other toolkits that were not present in the previous articles.


== Current State of GUI Toolkits for Ruby ==
= Current State of GUI Toolkits for Ruby =


There is a number of Ruby GUI toolkits to choose from to create a desktop application. In one of the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_PH#Projects_developed_in_wxRuby previous] articles, an official 2008 Ruby GUI Survey was referenced to discuss the popularity of available GUI toolkits. For a quick recap, here is the result for the question "''Which of the GUI toolkits do you currently use, and which do you think it's likely you'll use in the future?''"
There is a number of Ruby GUI toolkits to choose from to create a desktop application. In one of the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_PH#Projects_developed_in_wxRuby previous] articles, an official 2008 Ruby GUI Survey was referenced to discuss the popularity of available GUI toolkits. For a quick recap, here is the result for the question "''Which of the GUI toolkits do you currently use, and which do you think it's likely you'll use in the future?''"
Line 38: Line 38:
However, even though most of these projects are being maintained, there has not been much growth to the GUI community for Ruby. There's still a very low number of applications that are built using GUI toolkits for Ruby, and many of them are personal projects. A simply Google search for Ruby GUI toolkits will return results that mostly predates 2010.
However, even though most of these projects are being maintained, there has not been much growth to the GUI community for Ruby. There's still a very low number of applications that are built using GUI toolkits for Ruby, and many of them are personal projects. A simply Google search for Ruby GUI toolkits will return results that mostly predates 2010.


== Overview of other GUI toolkits ==
= Overview of other GUI toolkits =
This article will not attempt to cover the same toolkits that were discussed in the previous articles. The following toolkits are not the most popular choices for Ruby GUI development. However, comparisons can then be made with more popular options by examining the necessary steps to get each one of them up and running
This section will not attempt to cover the same toolkits that were discussed in the previous articles, as there are simply not enough advancements to them to warrant further discussions. The following toolkits are not the most popular choices for Ruby GUI development, according to [https://www.ruby-toolbox.com/categories/GUI_Frameworks The Ruby Toolbox]. However, by reviewing what theses toolkits have to offer, comparisons can then be made with more popular options by examining their advantages and disadvantages.


=== Visual Ruby ===
== Visual Ruby ==
[http://visualruby.net/ Visual Ruby] is designed to simplify the process of adding a GTK+ windows to Ruby applications. It is also designed to completely integrate with the Glade user interface designer.
[http://visualruby.net/ Visual Ruby] is designed to simplify the process of adding a GTK+ windows to Ruby applications. It is also designed to completely integrate with the Glade user interface designer.


==== Installation ====  
=== Installation ===
# Install Ruby 1.9.3
# Install Ruby 1.9.3
# Install Glade and GTK
# Install Glade and GTK
Line 50: Line 50:
  >> gem install visualruby
  >> gem install visualruby


==== Up and Running ====
=== Up and Running ===
To run Visual Ruby, simply run the following command
To run Visual Ruby, simply run the following command
  >> vr
  >> vr
Line 60: Line 60:
[[File:Visual_ruby_2.png]]
[[File:Visual_ruby_2.png]]


=== Monkeybars ===
[https://github.com/monkeybars/monkeybars-core Monkeybars] is a library that enables the use of Swing from JRuby. Monkeybars aims to allow you to continue using the GUI editing tools you are used to but makes it easy to write all your application logic in pure Ruby. It utilizes the Model, View, Controller (MVC) design pattern to separate view logic and user interface components from application logic.


It should be noted, however, that monkeybars should not be the first choice if you're looking to quickly create a GUI application from scratch. The overhead of getting one of these projects up and running will be relatively higher than some other libraries.
To create a brand new project, simply follow the instructions below:


What monkeybars is good for is building large and complex GUI applications since it is based on the mature Java language and Swing libraries. If creating Swing applications with Ruby is what you're looking for, this will be a reasonable choice. [http://www.ibm.com/developerworks/library/j-monkeybars/index.html]
#Runs Visual Ruby if not already running
#Press "Select Folder" button at the bottom of the project selector ("Open project" if VR is already running to get to the project selector)
#Navigate to the directory to your choice, and press "Create Folder" on the top right with the project name of your choice
#Press "Open", and an new default "Hello World" application will appear


==== Installation ====
=== Pros and Cons ===
*Pros
**Very easy to set up.
**Available on all three major platforms (Windows, Linux, Mac)
**Integration with Glade visual designer provides another easy option to create layouts
 
*Cons
**Although it is available on all three platforms, it is obvious that it was made with Linux in mind. Launching anything from VR is essentially running a command, and those commands may not be available on Windows (e.g. selecting a Glade file and launching Glade did not work from within VR. Glade had to run manually).
 
== Monkeybars ==
[https://github.com/monkeybars/monkeybars-core Monkeybars] is a library that enables the use of [http://en.wikipedia.org/wiki/Swing_%28Java%29 Swing] from [http://en.wikipedia.org/wiki/JRuby JRuby]. JRuby is the Java implementation of the Ruby interpreter. This means Ruby code is executed in the JVM. As you'd expect, JRuby is tightly integrated with Java, and it has the ability to invoke classes of the Java platform. As a result, Swing, the Java GUI toolkit, can be used with JRuby.
 
Monkeybars aims to allow you to continue using the GUI editing tools (e.g. Netbeans) you are used to but makes it easy to write all your application logic in pure Ruby. It utilizes the Model, View, Controller (MVC) design pattern to separate view logic and user interface components from application logic.[http://monkeybars.rubyforge.org/] It should be noted, however, that Monkeybars should not be the first choice if you're looking to quickly create a GUI application from scratch. The overhead of getting one of these projects up and running will be relatively higher than most of the other libraries.
 
Monkeybars excels at building large and complex GUI applications since it is based on the mature Java language and Swing libraries. This will be a big advantage if creating non-trivial Swing applications with the logic written in Ruby is what you're looking for.[http://www.ibm.com/developerworks/library/j-monkeybars/index.html]
 
=== Installation ===
# Install Java and JRuby
# Install Java and JRuby
# Install Monkeybars
# Install Monkeybars
Line 74: Line 91:
  >> gem install monkeybars
  >> gem install monkeybars


==== Up and Running ====
=== Up and Running ===
To create a new project directory
To create a new project directory


Line 81: Line 98:
After creating a new monkeybars project, follow the detailed tutorials [http://monkeybars.org/tutorials.html here] to configure your project.
After creating a new monkeybars project, follow the detailed tutorials [http://monkeybars.org/tutorials.html here] to configure your project.


=== Pros and Cons ===
*Pros
**Easy to install
**Project structure is better suited for large and complex applications


=== FFI-Tk ===
*Cons
**Creating a new project has high overhead
**Requires too much effort for simple GUI applications


[https://github.com/manveru/ffi-tk FFI-Tk] is a pure Ruby FFI (foreign funciton interface) wrapper for the Tk GUI toolkit.
== FFI-Tk ==
[https://github.com/manveru/ffi-tk FFI-Tk] is a pure Ruby FFI (foreign funciton interface) wrapper for the Tk GUI toolkit. Since it uses [https://github.com/ffi/ffi/wiki/Why-use-FFI FFI], it is meant to be provided as an extension that doesn't need compilation and is multi-platformed.[https://github.com/ffi/ffi/wiki/Why-use-FFI]


==== Installation ====
=== Installation ===


  gem install ffi-tk
  gem install ffi-tk


==== Up and Running ====
=== Up and Running ===
# Sample code taken from https://github.com/manveru/ffi-tk
  require 'ffi-tk'
  require 'ffi-tk'
  Tk.init
  Tk.init
Line 98: Line 123:
  Tk.mainloop
  Tk.mainloop


== Conclusion ==
=== Pros and Cons ===
Although there are many toolkits available for building GUI applications with Ruby, there hasn't been much growth in this area relative to 2010. One possible explanation is that the popularity of desktop application develop has yielded to web applications, which Ruby is most well known for due to it's Rails framework. By looking at the several toolkits examined above, we can also see why some of them remain to be less popular than others. Monkeybars, for example, has too much overhead just to get an application up and running. The more dependencies that are necessary, the heavier the toolkit feels. It does seem, however, that the more popular options will continue to be stable projects. One example is Shoes. Shoes is currently at version 3, and a new version is coming soon. Shoes 4 will be the next version of Shoes[https://github.com/shoes/shoes4]. Perhaps this is why the [http://shoesrb.com/downloads download] page for Shoes is currently void of any content.
*Pros
 
**Easy to use for simple applications
== References ==
**Eliminates different ways of coding to achieve the same result


[1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_PH Previous Submission 1]
*Cons
**Still uses the TK GUI styling, which is the main complain about TK anyways


[2] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_MM Previous Submission 2]
= Conclusion =
Although there are many toolkits available for building GUI applications with Ruby, there hasn't been much growth in this area relative to 2010. One possible explanation is that the popularity of desktop application develop has yielded to web applications, which Ruby is most well known for due to its Rails framework. By looking at the several toolkits examined above, we can also see why some of them remain to be less popular than others. Monkeybars, for example, has too much overhead just to get an application up and running. The more dependencies, the heavier the toolkit feels. FFI::TK, on the other hand, does not offer any more features than others to warrant popular use. It does seem, however, several of the most popular options will continue to be stable projects. One example is Shoes. Shoes is currently at version 3, and a new version is coming soon. Shoes 4 will be the next version of Shoes[https://github.com/shoes/shoes4]. Perhaps this is why the [http://shoesrb.com/downloads download] page for Shoes is currently void of any content.


[3] [http://www.ibm.com/developerworks/library/j-monkeybars/index.html The monkeybars library]
= External Links =
*[https://www.ruby-toolbox.com/categories/GUI_Frameworks The Ruby Toolbox GUI Frameworks]
*[http://visualruby.net/ Visual Ruby Homepage]
*[https://github.com/monkeybars/monkeybars-core Monkeybars GitHub Page]
*[https://github.com/manveru/ffi-tk FFI-Tk GitHub Page]


[4] [http://shoesrb.com/downloads Shoes 4 Github Page]
= References =
[1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_PH Previous Submission 1] <br />
[2] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch1_S10_MM Previous Submission 2] <br />
[3] [http://monkeybars.rubyforge.org/ Monkeybars Homepage] <br />
[4] [http://www.ibm.com/developerworks/library/j-monkeybars/index.html The monkeybars library] <br />
[5] [https://github.com/ffi/ffi/wiki/Why-use-FFI Why use FFI] <br />
[6] [http://shoesrb.com/downloads Shoes 4 Github Page] <br />

Latest revision as of 18:00, 15 February 2013

Introduction

Topic Writeup

Ruby as a programming language has gained popularity in recent years (mainly due to the Rails web framework). There exists quite a few graphical user interface toolkits/frameworks for Ruby so that desktop GUI applications can be created. Most are simply bindings to existing GUI framework API's like Qt and GTK+, so they may seem awkward and unfitting to the Ruby language's style. Shoes, on the other hand, is written for Ruby specifically. Two previous articles have made detailed comparisons between different toolkits by looking at various factors such as ease of installation, documentation, look and feel, and difficulty of usage.[1][2] This article will give updates on GUI toolkits that has developed since the previous articles were written, as well as discuss other toolkits that were not present in the previous articles.

Current State of GUI Toolkits for Ruby

There is a number of Ruby GUI toolkits to choose from to create a desktop application. In one of the previous articles, an official 2008 Ruby GUI Survey was referenced to discuss the popularity of available GUI toolkits. For a quick recap, here is the result for the question "Which of the GUI toolkits do you currently use, and which do you think it's likely you'll use in the future?"

Survey Results
  1. Shoes
  2. Ruby-GNOME2/GTK
  3. wxRuby
  4. Ruby-Tk
  5. Ruby Cocoa/MacRuby
  6. QtRuby
  7. JRuby + Swing
  8. FxRuby
  9. JRuby + SWT


The Ruby Toolbox, a website that tracks the popularity of Ruby related tools by usage in open source projects, has a list of several toolkits under its "GUI Frameworks" category. The ranking in current popularity (Feb 2013) of GUI toolkits is as follows:

  1. Shoes
  2. FxRuby
  3. wxRuby
  4. QtBindings
  5. Ruby/GTK
  6. monkeybars
  7. FFI::Tk


Although this list is not as scientific as the official survey result, it does reflect current project usage quite well, and it shows the general acceptance of a particular toolkit. We can see by comparing the two lists that the most popular toolkits (Shoes, FxRuby, wxRuby, Ruby/GTK) are still relevant today. Shoes has proven to be a popular choice since its creation in 2007. Most of the other toolkits remain stable, judging by the dates of code commits of their respective repository. One main exception is wxRuby. wxRuby has not seen a release since September of 2009 even though wxWidgets, the C++ GUI library which wxRuby is based, is still in active development.

However, even though most of these projects are being maintained, there has not been much growth to the GUI community for Ruby. There's still a very low number of applications that are built using GUI toolkits for Ruby, and many of them are personal projects. A simply Google search for Ruby GUI toolkits will return results that mostly predates 2010.

Overview of other GUI toolkits

This section will not attempt to cover the same toolkits that were discussed in the previous articles, as there are simply not enough advancements to them to warrant further discussions. The following toolkits are not the most popular choices for Ruby GUI development, according to The Ruby Toolbox. However, by reviewing what theses toolkits have to offer, comparisons can then be made with more popular options by examining their advantages and disadvantages.

Visual Ruby

Visual Ruby is designed to simplify the process of adding a GTK+ windows to Ruby applications. It is also designed to completely integrate with the Glade user interface designer.

Installation

  1. Install Ruby 1.9.3
  2. Install Glade and GTK
  3. Install
>> gem install visualruby

Up and Running

To run Visual Ruby, simply run the following command

>> vr

After starting up VR, you will see a list of example projects that you can open and run.


To create a brand new project, simply follow the instructions below:

  1. Runs Visual Ruby if not already running
  2. Press "Select Folder" button at the bottom of the project selector ("Open project" if VR is already running to get to the project selector)
  3. Navigate to the directory to your choice, and press "Create Folder" on the top right with the project name of your choice
  4. Press "Open", and an new default "Hello World" application will appear

Pros and Cons

  • Pros
    • Very easy to set up.
    • Available on all three major platforms (Windows, Linux, Mac)
    • Integration with Glade visual designer provides another easy option to create layouts
  • Cons
    • Although it is available on all three platforms, it is obvious that it was made with Linux in mind. Launching anything from VR is essentially running a command, and those commands may not be available on Windows (e.g. selecting a Glade file and launching Glade did not work from within VR. Glade had to run manually).

Monkeybars

Monkeybars is a library that enables the use of Swing from JRuby. JRuby is the Java implementation of the Ruby interpreter. This means Ruby code is executed in the JVM. As you'd expect, JRuby is tightly integrated with Java, and it has the ability to invoke classes of the Java platform. As a result, Swing, the Java GUI toolkit, can be used with JRuby.

Monkeybars aims to allow you to continue using the GUI editing tools (e.g. Netbeans) you are used to but makes it easy to write all your application logic in pure Ruby. It utilizes the Model, View, Controller (MVC) design pattern to separate view logic and user interface components from application logic.[3] It should be noted, however, that Monkeybars should not be the first choice if you're looking to quickly create a GUI application from scratch. The overhead of getting one of these projects up and running will be relatively higher than most of the other libraries.

Monkeybars excels at building large and complex GUI applications since it is based on the mature Java language and Swing libraries. This will be a big advantage if creating non-trivial Swing applications with the logic written in Ruby is what you're looking for.[4]

Installation

  1. Install Java and JRuby
  2. Install Monkeybars
>> gem install rawr
>> gem install monkeybars

Up and Running

To create a new project directory

>> monkeybars test_project

After creating a new monkeybars project, follow the detailed tutorials here to configure your project.

Pros and Cons

  • Pros
    • Easy to install
    • Project structure is better suited for large and complex applications
  • Cons
    • Creating a new project has high overhead
    • Requires too much effort for simple GUI applications

FFI-Tk

FFI-Tk is a pure Ruby FFI (foreign funciton interface) wrapper for the Tk GUI toolkit. Since it uses FFI, it is meant to be provided as an extension that doesn't need compilation and is multi-platformed.[5]

Installation

gem install ffi-tk

Up and Running

# Sample code taken from https://github.com/manveru/ffi-tk
require 'ffi-tk'
Tk.init
Tk::Button.new('.', text: 'Press me'){
  Tk.message_box(message: 'Hello, World!')
}.pack
Tk.mainloop

Pros and Cons

  • Pros
    • Easy to use for simple applications
    • Eliminates different ways of coding to achieve the same result
  • Cons
    • Still uses the TK GUI styling, which is the main complain about TK anyways

Conclusion

Although there are many toolkits available for building GUI applications with Ruby, there hasn't been much growth in this area relative to 2010. One possible explanation is that the popularity of desktop application develop has yielded to web applications, which Ruby is most well known for due to its Rails framework. By looking at the several toolkits examined above, we can also see why some of them remain to be less popular than others. Monkeybars, for example, has too much overhead just to get an application up and running. The more dependencies, the heavier the toolkit feels. FFI::TK, on the other hand, does not offer any more features than others to warrant popular use. It does seem, however, several of the most popular options will continue to be stable projects. One example is Shoes. Shoes is currently at version 3, and a new version is coming soon. Shoes 4 will be the next version of Shoes[6]. Perhaps this is why the download page for Shoes is currently void of any content.

External Links

References

[1] Previous Submission 1
[2] Previous Submission 2
[3] Monkeybars Homepage
[4] The monkeybars library
[5] Why use FFI
[6] Shoes 4 Github Page