Tags

, , , , , , , , ,

The term mentioned in this topic is really confused me a lot. This confusion ends with the below result. Here we see what it means and how it differ with each other.

Ruby

Ruby is a scripting language that is based on C, requires a Ruby interpreter, usually written in C. Ruby is a multi-paradigm programming language, so you have much more flexibility. Because Ruby is interpreted by a C coded interpreter, it is available for real time applications.

A strong reason to prefer Ruby is the fact that it lives in multiple implementations. Ruby is a tool you can use in a lot of other places, means it is not only focused on Java like Groovy.

Groovy

Groovy is a scripting language that is based on Java, requires a JVM to run it. Groovy is strictly object-oriented. Everything in Groovy – including the scripts themselves – is an object. Since Groovy is interpreted by the JVM (after it’s compiled to bytecode), it should not be used for real time applications. Groovy can access Java code seamlessly, because it’s built on Java.

Rails (aka) Ruby on Rails

Rails is the framework for developing Web applications for Ruby. Rails makes it easy to use Ruby language for writing stuff that makes a dynamic database driven website work. Rails relies on a set of packages called “Ruby Gems,” small, encapsulated systems that can be plugged in straight into the Ruby language.

Grails (aka) Groovy on rails

Grails is the framework for developing web applications for Groovy. Grails relies a lot on the Java Spring framework for a lot of its capabilities (request routing, web service support, data layer).

Both Rails and Grails are very similar architecturally. The main difference between Rails and Grails is that in Rails the plugin support comes straight into Ruby language whereas in Grails, the plugin support comes straight to Grails. This makes Ruby/Rails applications much easier to share benefits with other Ruby applications which are not necessarily built on Rails. But in Groovy/Grails applications, you can share the benefits of groovy between other Groovy/Grails applications only and not with the plain groovy applications.

While both Ruby and Groovy are standalone programming languages, Ruby tends to stand out more on its own. Groovy is almost always associated with Grails.

JRuby

JRuby is a java implementation of the Ruby platform. Ruby runs within a native C based interpreter whereas JRuby runs inside the Java Virtual Machine. If you would like to deploy to a java web server, then JRuby would be the way to go.

The fact that JRuby is a Ruby platform on the JVM means that in JRuby you have two kinds of objects – JRuby objects and Java objects. Although there are ways for the two to talk to each other and to convert there is a difference. There are times when you need to know whether you’re dealing with a Java string or a JRuby string. With Groovy you don’t have that boundary, there are just Java objects.

Difference between Groovy and JRuby

Groovy is designed to be a scripting language for Java. As much as possible its syntax tries to match the equivalent in Java. It also works with Java’s class library directly, although it dynamically adds many methods to Java’s classes, vital in order to make use of things like closures.

JRuby, however, is a Java implementation of the Ruby platform. Ruby can run directly on mainstream operating systems with a C runtime, and is starting to run on .NET’s CLR. When you program in JRuby you primarily use Ruby’s libraries which are implemented in Java, and may also use Java’s libraries at your discretion. If you stick to Ruby’s libraries, or at least wrap any foreign elements, you can run Ruby programs on the C, Java, or (in time) .NET runtimes. So you can use JRuby to both run Ruby programs on the JVM and as a language for scripting the JVM.

Reference:

1. Groovy vs JRuby by Martin Fowler

Advertisements