This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ruby

 
Rakesh Jhamb
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I would like to know more about Ruby and JRuby, specifically what is the difference between the two...and where these languages are ideal to apply?
 
Michael Sullivan
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a list of the different Ruby Implementations I've heard of (referenced from Wikipedia):

Ruby or MRI: Matz Ruby Implementation, implemented in C. This is the original Ruby implementation
YARV: likely candidate of Ruby2.0
JRuby: Ruby implemented in Java
IronRuby: Ruby implemented on a .net platform (on top of the CLR using the DLR)
Gardens Point Ruby.net: Ruby on a .net platform (on top of the CLR without using the DLR)
Cardinal: Ruby for the Parrot VM
MacRuby: Ruby 1.9 running directly on top of Mac OS X core technologies
MetaRuby: Ruby based implementation of Ruby, using ruby2c
Rubinius: Implementation of a Ruby VM almost entirely in Ruby


So, to answer your question - the original Ruby implementation is written in C, and JRuby is a ruby port in Java. If you needed to run Ruby on the JVM, or wanted to do so in order to have two-way communication between Ruby and Java - you'd use JRuby.

From JavaWorld

Dynamic languages like Ruby are most commonly used for specialized areas such as gluing other systems together; JRuby takes on this role in the Java world. For example, JRuby can pull data from one system, transform it and insert it into another. When the requirements change, modifying a JRuby script is as easy as changing a configuration file, thereby avoiding the complex compile-and-deploy cycle of Java integration code.

In addition to calling Java from Ruby, you can call Ruby from Java, making your application scriptable. With JRuby's minimal syntactic overhead, you can create an easy-to-use domain-specific language for users to work with (see "Creating DSLs with Ruby" by Jim Freeze). "



Hope that helps!
 
Jeremy McAnally
Author
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Michael noted, JRuby is merely an implementation of the Ruby language on the JVM. So, effectively there is no difference, but as always, there will be "artifacts" between the two due to implementation details (f.e., threads perform better but behave a little differently in JRuby).
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic