The Ruby programming language is feeling a lot of love these days as it enjoys an increased profile among Internet-era developers. First created by a Japanese programmer in 1993, Ruby
Ruby is a dynamic programming language, which means it can change its structure as it runs. Functions may be introduced or removed, new classes of objects may be created or removed and new modules may be added.
The real power of Ruby, and most dynamic languages, is that a lot can be done in very little code. According to Richard Monson-Haefel, senior analyst for Burton Group who covers programming languages, there is a 5:1 ratio between static and dynamic languages in terms of lines of code. A function requiring five lines of code in C++ only needs one line in Ruby.
What Ruby, an open source project led by some Internet programmers with no corporate backing, lacks is an ecosystem of libraries and classes, something Java and Microsoft’s .NET framework have in spades.
Cue two new projects to bring Ruby to Java and .Net. IronRuby is a Ruby-on-.NET project created by Wilco Bauwer, a college student in The Netherlands who has interned at Microsoft’s
Redmond, WA headquarters, where he worked on the Atlas project.
On this side of the Atlantic is JRuby, a project started by two Java consultants, Charles Nutter and Thomas Enebo. The two presented their work recently at the JavaOne conference in San Francisco, with Sun’s approval.
Monson-Haefel said combining the easy-to-use Ruby language with the Java and .NET environments is a best of both worlds scenario for developers. “You get the productivity of a dynamic language and the extensibility of these ecosystems,” he said. “Dynamic languages don’t have a lot of libraries. They often have trouble taking off because they don’t have the library support you see with Java and .NET.”
While Sun has more or less given JRuby its blessing, complete with some hardware donated courtesy of Sun programming guru Tim Bray, Microsoft has said nothing on IronRuby. Bauwer said he plans to use the Visual Studio SDK, since it has facilities to integrate a language with Visual Studio.
However, Monson-Haefel doesn’t think the company will appreciate another language muscling in on Visual C#’s territory, either. “I suspect Microsoft would not be happy to have another language work on the .Net platform,” he said. Microsoft had no comment.
IronRuby is the Ruby language written entirely in Microsoft’s C#., with the code compiled to MSIL, the language to which all .NET languages compile. In an email interview with internetnews.com, Bauwer said he got the itch to build his own compiler after being assigned to do just that in a computer science course.
“I figured that if people love Ruby so much, why not let people write Ruby for .NET as well? By implementing Ruby for .NET people can both use Ruby to write (parts of their) .NET applications and bring functionality written in .NET to their Ruby applications,” he said.
He noted that the .NET platform offers a number of services that Ruby lacks, like a Just-In-Time compiler, garbage collection and a debugger. These services are shared by all code that runs on .NET, including Ruby code, so the .NET debugger can check both Ruby and C# code.
Nutter said he had the same motivation as Bauwer in his Ruby project; to bring the Ruby world a better platform for writing applications, and also to bring the simpler Ruby language to the Java world.
“It’s a win for both,” he said. “The Java community has become more interested in Ruby and alternative languages in general. Sun made a statement at JavaOne that they are committed to making the platform multilingual. Obviously they are getting it.”
The maturity of the Java platform is a definite plus for Ruby. For example, Ruby on Rails would normally need a native driver for every database it wishes to connect to. With JRuby, the applications simply use the JDBC driver to connect to any JDBC database, eliminating that hurdle.
JRuby is open source right now, hosted on Sourceforge and available under the GPL, LGPL and CPL licenses. Nutter said he’s around the 0.9 revision level and hopes to hit 1.0 by summer. He’s hoping that once full support for Ruby on Rails is in JRuby this summer, he can call it a 1.0 release.
Bauwer hopes to have a new release within two months, and from there he can release the source code and begin to build a community around it.
Monson-Haefel is more optimistic about the Java world’s embrace of dynamic languages than Microsoft. Java 7, currently in the early stages of development and expected in 2008, will have support for dynamic languages.
Microsoft, on the other hand, has always gone its own way, even so far as to make its own modeling language rather than support the popular industry standard UML.
“Whether they support dynamic languages remains to be seen,” said Monson-Haefel. “They will probably make their own.”