December 31, 2007

Ruby is the next platform for Java Developers. Is it?

I was reading the cover page article of JDJ magazine. In this article author has stated Ruby as a next platform for every Java developer. I tried to check this thought and writer's proof.

Ruby is growing very rapidly, but it has to find its place in enterprise application development.
As per wikipedia "Ruby is a reflective, dynamic, object-oriented programming language. It combines syntax inspired by Perl with Smalltalk-like object-oriented features, and also shares some features with Python, Lisp, Dylan, and CLU. Ruby is a single-pass interpreted language. Its official implementation is free software written in C."
And it's programming style takes it close to Aspect Oriented programming also.

In earlier days Ruby was a academic language and it was loved by Smalltalk users. But its framework Ruby on Rails made it quite famous among the programmers.
Because of its syntax, initially PHP developers attracted to it. Lack of structure and custom standard development in PHP also moved PHPers to Ruby.Java developers joined the Ruby Rail because of the complexities in their frameworks and components

Some of the Ruby features put it class apart from Java.


Convention over Configuration:
Every java developer especially J2EE developer has to maintain lots of XML configuration files. Rails provide solution of this problem by setting file, database table, and column naming as well as directory structure.

DRY up your code feature:
DRY stands for Don't Repeat Yourself. Similar java implementations make it really hard to change. But in Ruby, because most of the implementation details are implied from a master source, making changes in Rails become straightforward and generally requires change in a single location.

But as every language Ruby also has its problems.

  • Deployment is a problem in Ruby. Rails is not thread safe so parallelism must be done at process level by running multiple application server processes.
  • Rails projects do not have separation between the developer and operations.
  • In industry there is a lack of experience and talent in enterprise or large application development.
  • There is a lack of enough libraries also.

So what that mean Ruby is not mature enough to handle big enterprise application? No.

There is something called JRuby. It's sponsored by Sun and bridging gaps between Java and Ruby. JRuby is an implementation of Ruby on JVM. Using a plug-in called gold spike, a Ruby application can be bundled into .war file.JRuby also facilitates Java-Ruby integration. Importing a java library into Ruby is also possible.

In this way I think Ruby getting ready to take on Java and for some time it will act as a facilitator for Java. But for sure Ruby is the future.

8 comments:

  1. Not Ruby, but Scala. It contains many of the positive aspects of Java, like performance and static typing. On the other hand, it is very concise like Ruby. It has also nearly perfect interoperability with Java, so it is possible to reuse all existing Java frameworks and gradually migrate to Scala.

    See for instance: http://scala-blogs.org/2007/12/scala-statically-typed-dynamic-language.html

    ReplyDelete
  2. "ruby is the future".. that was funny

    ReplyDelete
  3. Joni- I agree that scala is a pwerful language but it's not feasible to develope enterprise application in scala.
    There is no bridge by which scala can communicate with java.

    ReplyDelete
  4. himanshu, I'm not a Scala fan for other reasons (2.5MB runtime and an excess of features), but Scala can call into Java directly as Joni already stated.

    ReplyDelete
  5. Ruby != Rails.
    Ruby is in and of itself a superlative language, so equating it with Rails is to ignore most of the story. Rails is not the beginning and the end of all things Ruby. We have successfully used pure Ruby (no Rails) to implement a DSL for a bank, I think it was, to handle the complex and ever changing rules of the commissions business. This would have been orders of magnitude harder to implement in Java.

    What weaknesses Ruby has lie in the performance of runtime and these are being fixed at a phenomenal pace. Ruby 1.9 should be at least as fast as Python.

    @joni
    Scala is a lovely language, but it differs from Ruby significantly in that it is statically typed and has no language introspection and manipulation capabilities. This makes it both faster than Ruby and less flexible than Ruby. See Scala initial impressions"

    @himanshu
    Scala has a one to one mapping between Scala objects and Java objects, much like Groovy. There no need for any kind of bridge - a Scala object can instantiate and use a Java object quite transparently. JRuby objects on the other hand are Ruby objects and so need a bridge to talk to Java objects. More at this article, Groovy or JRuby. Also, Scala is quite ready for the enterprise, if we take that to mean it is mature, stable and ready to be used in anger. Usually though, 'Enterprise ready' is less a technology issue and more a political one, encompassing issues like support from IT departments of various organisations and the backing of at least one major vendor.

    The danger in large scale Ruby development lies in the fact that while it [Ruby] grants a developer the power of the gods to work miracles, it also gives idiots similarly great abilities to wreck disasters. A team working in Ruby needs to be highly disciplined and capable. They should understand TDD and good design and adhere to certain conventions. Without this, any Ruby project is doomed. With this, you can expect stupendous productivity and code which will make you jaw drop.

    ReplyDelete
  6. I would bet on Scala. It works very well Java Libraries yet, and from version 2.6.2. on even generics compatible.

    ReplyDelete
  7. Did .NET replace Java? No.

    The same is going to happen with Ruby. Ruby has its strengths and weaknesses. Ruby is not going to replace Java in any near future.

    There have been so many improvements that was going on in Java. There is a very rich set of open source libraries and tools in Java. It is not easy to replace all these with Ruby even in 5 years!

    ReplyDelete
  8. Which language replaced Cobol? When will Windows stamp out *nix? All we are really commenting on is the usefulness of a new language. All the languages continue to grow, look at Fortran. As a programmer, I can use whatever language is called for and generally do use lots more that just one in any project. But to say that good Java programmers aught to take look at Ruby is probably true.

    ReplyDelete