Move over, AJAX; Microsoft is pushing a different scenario, known as Asynchronous Ruby and XML, or ARAX.
At the RailsConf conference for Ruby on Rails developers in Portland, Ore., on May 30, John Lam, creator of the IronRuby project at Microsoft, told eWEEK that as Microsoft’s Silverlight rich Internet application environment takes off it will provide Ruby developers with a way to deliver AJAX (Asynchronous JavaScript and XML)-style applications without having to use JavaScript.
“If you’re a Ruby programmer and you like Ruby as a language, context-switching into JavaScript is just something you have to do,” Lam said. “It’s a tax. You’re trading productivity away arbitrarily because that’s just what runs in the browser. And it’s much more interesting when you can run the same language on both sides [the client and the server] so you don’t have to do that context switch.”
In essence, using ARAX, Ruby developers would not have to go through the machinations of using something like the RJS (Ruby JavaScript) utility, where they write Ruby code and RJS generates JavaScript code to run on the client, Lam said. “Sure, you could do it that way, but then at some point you might have to add some JavaScript code that adds some custom functionality on the client yourself,” he said. “So there’s always that sense of, ‘Now I’m in another world. And wouldn’t it be nice if I have this utility class I wrote in Ruby…’ Today if I want to use it in the browser I have to port it to JavaScript. Now I can just run it in the browser.”
According to Lam, the scenario is that people agree that HTML and CSS (Cascading Style Sheets) are standard. “It’s a known thing and people understand this technology,” Lam said. “The part that [is important], at least as far as Rails programmers are concerned with, is they would like to be able to do some Ruby on the client. JavaScript is no longer the ugly stepchild that it used to be, but it’s quirky in certain ways. That’s not to say that Ruby isn’t, but Ruby has more ‘oohs and ahs’ about it than JavaScript does.”
Moreover, “If we do our jobs right and we get Silverlight to play very widely, then all of a sudden for folks that are interested in doing some ARAX, they can. They have to ask, Do we want to take a dependency on this thing? It’s pretty brain-dead to take a dependency on Flash, because Flash is everywhere already. So this becomes a more compelling scenario over time,” he said, noting that as Silverlight adoption grows the opportunity for ARAX development increases.
Ben Galbraith, co-founder of Ajaxian.com, said of ARAX: “If this is about using Silverlight to host client-side browser scripting in Ruby, it’s definitely an appealing notion, but the problem will always be about Silverlight being a Microsoft technology.”
Indeed, Galbraith said, “As long as Windows/Office dominates Microsoft’s balance sheet, these cross-platform Microsoft plays always feel a bit like the story of the boy who upon encountering a rattlesnake picks it up after it promises not to hurt him, upon which the snake promptly bites. After the boy protests, the snake says: ‘You knew what I was when you picked me up.’ No matter what capabilities Silverlight may have, I think most of us in the community simply wouldn’t dream of embracing architectures dependent on Microsoft’s goodwill to support other OS vendors.”
Dion Almaer, the other co-founder of Ajaxian.com, said, “It is interesting to note that you have been able to use JRuby to run Ruby in the browser for quite some time … IronRuby is great. Getting more languages into the browser is great.”
In a blog post, Troy Taft, principal consultant and founder of Troy Taft Consulting, a software development firm, said: “Silverlight and the plug-in RIA wars … caught me by surprise. I didn’t expect Ruby to have a chance at the client. This may make ARAX become more popular than AJAX because you can actually write client-based applications in Silverlight with Ruby in the near future if everything goes well.”
And although Taft (no relation to this reporter) said he considers himself a “JavaScript promoter,” he wrote: “Why do I think that Ruby is better than JavaScript? Mostly because it expresses objects more respectably and it has a cleaner syntax that works in an obvious way to me as developer. This makes the code very readable and easy to use.”
Meanwhile, in a session at RailsConf, Lam showed IronRuby running Ruby on Rails code.
“Our goal was to show that Rails guys could use Silverlight as well,” Lam said. “And if you wanted to use Ruby to do some HTML stuff, if you want to do ARAX on the client, awesome. Knock yourself out.”
With IronRuby, Lam said he demonstrated that Microsoft could dispatch simple Rails requests. “So we can dispatch these static page requests,” he said. “We showed some dynamic stuff happening-we demonstrated we could dispatch to a controller, which will render using a view. And then we showed we could use ActiveRecord to round-trip from SQL Server and return like a single row. So we could demonstrate we could go through the Active Record path. So we can read from database, we can create databases; I don’t think we can update or delete or any of that stuff yet. But that’s coming. This was a demonstration of our commitment to building a Ruby that runs real Ruby programs.”
Lam said he is under no illusion that Rails developers will move in droves to IronRuby.
“Look around at the Rails conference, everybody’s carrying a Mac here,” Lam said. “And this community is a very ‘Unix-y’ community. There are just no if, ands or buts about it. So for us coming here and showing IronRuby running Rails, we weren’t under any illusions that people would convert to us simply because of that. So what we wanted to show was something new, something different. We allow people to run Ruby in the browser in a cross-platform way with a very lightweight download.”
And IronRuby’s support for Ruby on Rails will only get better as the team has more time to work on it, Lam said. Already, he said, he believes IronRuby is further along in its Rails support than either the JRuby or Rubinius projects were at the point when the same amount of time had been put into their efforts.
Ruby on Rails creator David Heinemeier Hansson offered praise for the IronRuby effort.
“It’s great to see Microsoft making progress on IronRuby,” Hansson said. “Just like JRuby provides people who are stuck with an inventory of Java infrastructure and programs an easy way into Ruby, so does IronRuby for those who are still sitting on a Microsoft stack.”
He added, “As with JRuby, though, I don’t expect a lot of Ruby programmers with no existing connection to Microsoft to go gaga over it.”