Moving From Java To Ruby & Beyond


Once upon a time, Java – arguably the “Dinosaur” of the coding world – was the dominant force in programming. A person needed to approach
software and webpage development with the mind of an engineer and the ability to think in complex, yet highly organized, ways. After all, there would be a
lot of code to sort through. Yet, higher-level languages like C, C++, Python, Perl and Ruby began to appear. These dynamic new languages threatened the old
vanguard and helped new programmers — who wanted a shortcut and didn’t wish to bother with all that clunky, awkward code — get into the game. Sure, there will always be criticisms that “there are bugs” or “it’s too slow,” but people who get into the swing of JRuby will find that it really does enhance productivity and free them from lower-level concerns of cost or functionality for the clients.   

Why Java Users Like JRuby

Ruby works very well with Java, thanks to the help of the JRuby interpreter.

Many Java users say that learning Ruby has helped simplify, clean and all-around improve their Java code. Functional programming and meta-programming are much easier to accomplish through the Ruby language.

Dynamic typing makes certain tasks much easier for Java programmers.

Like Ruby, JRuby uses dynamic typing. In Java, one has to declare the type of each variable. Wrong variables will produce an error message like “No Such Method Error” and “Invocation Target Exception,” which can be annoying and more time-consuming to sort through. On the other hand, Ruby doesn’t care much about an object’s class or other variables so much as the method. Ruby eliminates the need to suffer through verbose code and declare everything manually. Ruby will expand integers automatically, as needed, thus freeing up time and hassle. Of course, Java will always be the default for larger scale projects, since there are many more Java tools for deciphering code at development time.  

Interpreted language makes it easier to receive feedback and deal with field bugs.

Java programmers know that analyzing the code that caused a field bug can be a nightmare. Sometimes it’s downright impossible to determine an application’s precise build version and look up the code. Yet, with Ruby and JRuby, there is fast, interactive feedback on each line as it’s being typed and source codes are immediately available for analysis, enabling instant fixes as issues arise. Interpreted languages are viewed as slow compared to Java, but in the long run, the performance lag is negligible for most functions.      

Ruby silently adds functions to the object class and supports multiple programming paradigms easily.

Ruby and JRuby play well with other types of programming languages, making collaborations between developers and applications written in various codes much simpler. This type of functional programming is ideal for wrapping code blocks with before-and-after instructions, without defining methods or anonymous classes. Ruby and JRuby are most commonly used by Java users to glue different systems together.

Why Ruby Users Like JRuby

Ruby users, by nature, are more open to change – so long as they feel that change benefits them. After all, if it weren’t for dynamic new developments, they wouldn’t even have Ruby at all! Since Ruby was such a relief and downright joy to many programmers who hated Java from the get-go, they were naturally skeptical of this new “intrusion” of the Java world into their precious Ruby paradigm. However, many Ruby users appreciate some of the advanced capabilities possible with JRuby.

JRuby brings the added power of Java into the simplified world of Ruby.

While Ruby sped up and simplified web application development, it has always suffered a little in terms of high-end, enterprise-strength capability when working on large-scale projects. Java’’s vast world of virtual machines, application servers, libraries and back-end support makes it the leading platform for high-end server applications. However, JRuby allows access to many of these same libraries and support systems. JRuby can integrate with Java code, enabling Ruby users the ability to work on Java scripts, without writing in Java code. JRuby users can enjoy all the benefits of JVM’s awesome garbage collectors, libraries and optimizations.  

JRuby is faster and better for scaling.

JRuby Creator Charles Nutter said the benefits of JRuby over Ruby include “better scaling, will soon be faster, native unicode support, Java libraries, easy adoption in the enterprise environment and existing applications.” Compared to Ruby, there is better memory management, parallel-running native threads and improved performance. This is especially good when scaling up to cloud computing: developers can have the confidence of knowing their apps will “simply work” in this new environment.  

JRuby fills the gap between Java and Ruby nicely.

Now Ruby users can deploy Ruby apps on Java servlet containers and EE application servers like JBoss, Tomcat and Glassfish. They can integrate Ruby apps with cross-platform Java technologies like Spring, JMS, JMX, JPA, Hibernate, Swing, SWT and Java 2D. They can use Java-based tools like Ant and Maven, as well as advanced Ruby tools like Rake, Raven and Buildr, for flexible testing and optimization. In a nutshell, JRuby builds the bridge between Java and Ruby.

The Bottom Line:

JRuby isn’t perfect. It is a bit slow starting up and many people prefer to stick with Java for large-scale corporate projects, but it’s helping both Java coders and Ruby programmers become better at what they do. This much-needed bridge is narrowing the gap between process and performance, which is a welcome relief for many frustrated engineers.



By Alex Scott, founder of aMember – a membership subscription software that offers seamless wordpress integration