Archive for the 'Ruby' Category

Is Ruby the new Java? (live on stage)

Twice a year the Dutch Java User Group organizes a mini conference with sessions about Java, JEE, and everything related. In spring this day is called J-Spring (which has nothing to do with the Spring framework), in fall it’s called J-Fall. While preparing for RubyEnRails 2006 I thought it would be a good idea to enter a paper for the J-Spring, for an introductory session called Is Ruby The New Java?. I was a bit surprised when my paper was accepted, and even more surprised last Thursday (J-Spring day) about how many Java people showed an interest for my session: I got the big conference hall (and it really does look big when you climb the stage), filled with maybe some 200 people. Even though I got the usual nervous questions about things like duck typing and performance, I had the impression that overall, people really liked what they saw. Apparently Ruby and Rails are hot in Java land.

And likewise, Java is hot in Ruby and Rails land; allbeit with a slightly different angle. I’m talking about the JRuby project, an interface to Java allowing Ruby code to run under a Java Virtual Machine. JRuby’s ‘holy grail’ being to be able to run Rails applications in a Java application server. At this year’s JavaOne, JRuby lead developers Charles Nutter and Tom Enebo were able to show a working Rails application running under Tomcat. In spite of their help and a lot of emails, I did not manage to reproduce their setup for a demo at J-Spring. Instead, I showed how easy it is to call an EJB from Ruby, as well as a Rails application based not on a database but on a Java web service.

You might wonder what’s the use of such an interface to Java. Like I said in my J-Spring presentation, I believe it offers some great possibilities for the future of Ruby and Rails. Once Rails runs on the JVM, it becomes that much easier to use Rails within established enterprisey Java environments. For that to happen, Java developers working within those environments need to be convinced of Ruby and Rails’ added value. And so I hope that my presentation has helped to convert some of those Java developers to Java developers-who-want-to-develop-with-Rails.

If you’re interested you can download my presentation here.

2006-06-21. 3 responses.

RubyEnRails 2006 – The Week After

It’s been almost two weeks since RubyEnRails 2006, the first big Dutch/Belgian Ruby and Rails event. I think it’s safe to say that it was a success. Over 100 visitors showed up; we had an excellent venue and six very entertaining sessions:

  • Frank Oxener (Agile Dovadi) gave a live demo of building a Rails app and integrating with Google Maps.
  • Geert Rozendom (Newminds) told about his company’s efforts to integrate Microsoft Navision with a Rails frontend (we got some frowns here from people disliking anything Microsoft; well, a lot of people use Microsoft software, so deal with it guys!).
  • Michiel de Mare (Finalist) gave a Takahashi style introduction to object oriented programming with Ruby (up to and including continuations, a brave effort).
  • Stefan Kaes told us everything there is to know about Rails performance. He did a two hour session packed with tips and tricks for measuring, tuning and refactoring.
  • Wilco Bauwer is working on IronRuby, a Ruby compiler for .Net, similar to IronPython. There’s a lot of attention for RubyCLR, but not many people have picked up yet on Wilco’s project. He explained that the difference is that RubyCLR is building a bridge between native Ruby and the CLR, while IronRuby is a complete implementation of a Ruby interpreter in .Net (see for an explanation of the .Net lingo). Again some sour anti-Microsoft faces here, but they were all silenced in awe when Wilco got Ruby to play the Mission Impossible III trailer on the sides of a rotating cube.
  • Erik Veenstra, finally, Holland’s uber Ruby guru, did a session on metaprogramming in Ruby. He showed how to implement your own attr_reader/attr_writer methods, and, one step beyond, the road to creating DSLs with Ruby.

All in all it was a great day, fun to organize and a pleasure to meet so many Ruby and Rails enthousiasts at once. We should do this more often! Next time, we should maybe have separate Ruby and Rails tracks (most people want to do either Ruby or Rails; a shame really). And even though Huis de Voorst was a splendid venue, a more central location would perhaps be easier for most attendants. And we should have more sessions, and more advanced sessions. And onsite wifi so people can blog while they’re there. And less xxxl-sized t-shirts (there’s still a few left!). And, and, and……

(The presentations can be downloaded from rubyenrails.nl, but they’re Dutch except Stefan’s. Photos on Flickr, tagged rubyenrails.)

2006-05-30. One response.

A Truely Historic Rails Conference

For some mysterious reason, there seems to exist a correlation between the temperature outside and the amount of entries on my blog. A sudden and long-awaited spell of sunny weather has been making Holland happy for more than two weeks now. In the evenings I am faced with the choice between sitting outside for a little longer, glass of chilled wine in hand, waiting for the sun to set and the blackbirds to start singing — or sitting inside, behind the computer, working on my blog. What a tough choice.

It’s good to see the weather’s changing though, from downright hot to a temperature better suited for, let’s say, a conference. One week from now we’re hosting RubyEnRails 2006, the first major Dutch/Belgian Ruby and Rails event. Besides Dutch Ruby guru Erik Veenstra, some real-life Rails cases, and Wilco Bauwer presenting his Ruby-on-DotNet compiler, Stefan Kaes is doing a two-hour workshop on Rails performance. And then there’s the Rails introduction workshop Remco and I will do, coding a simple photo album application live to show how quick & easy it all is (that’s the plan, anyway!). Over 100 people have already registered. It may not be London, Chicago or Vancouver, but we do have the most historic venue of them all: a 17th century Dutch castle.

Huis de Voorst

2006-05-11. No responses.

Calling All EJBs — From Ruby?

After installing and playing with JRuby a few days ago, I started wondering if it would be possible to access an EJB from a JRuby script. After all, the Java code to call an EJB is purely client code, only communicating with an application server over an HTTP-like protocol (HTTP-like in BEA’s case, anyway). At my current project, the OptimalJ team generates all their domain code and delivers business services around that in the form of session EJBs to us, the web frontend team. We’re using BEA WebLogic Portal to code the frontend. Now if we’d have EJB access from JRuby, and Rails on JRuby (which seems to be only a matter of time), I guess we would be able to build a frontend like this in Rails. There’s just the tiny matter of convincing the company’s enterprise architect, who’s already sick of hearing me talk about Ruby and Rails.

Anyway, to the code! To my surprise (after 6 years of experience with EJBs, anything EJB-related working instantly comes as a great surprise) it was just a matter of JRubyfying the Java code that you would write to use an EJB. It just works, there’s nothing more to it. Here’s an example of the magic code:

require 'java'
 
include_class 'java.util.Properties'
include_class 'javax.naming.Context'
include_class 'javax.naming.InitialContext'
 
properties = Properties.new
properties.put(Context::INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory")
properties.put(Context::PROVIDER_URL, "t3://localhost:7001")
context = InitialContext.new(properties)
home = context.lookup("business-ejb-jndi-name")
business_ejb = home.create
result = business_ejb.someBusinessMethod(parameters)

Okay, here’s some small print. The example works on a BEA WebLogic application server. For another JEE application server you’ll need to fill in the correct InitialContextFactory class name. Fill in the JNDI name for the EJB after the lookup call. Also, before running the script, you’ll have to put the right libraries in the CLASSPATH environment variable. For example, for the BEA server I had to include weblogic.jar and the EJB client jar containing the home interface to the EJB. But once you’ve figured that out, it should work; I got it to work on JBoss as well as BEA. Consult your local Java guru if necessary.

I’ve put all this in a JRuby module (to be downloaded here), which enables you to write just this to call your favourite EJB:

require 'rejb'
business_ejb = Rejb::ejb("business-ejb-jndi-name")
result = business_ejb.someBusinessMethod(parameters)

I’ve been feeling very happy over the last few days, even though there’s no Spring in sight. Must be the summer of Ruby that’s coming…

2006-04-13. 4 responses.

Rails Team Ends Second In Dutch Development Contest

In Holland we have a yearly development contest called “Development Tools” (formerly RAD Race). In two days, several teams consisting of two coders build an administrative application according to fixed requirements, with database access, forms, reports, the works. The contest was originally organized for 4GL RAD tools, but in recent years Java teams have entered the competition. Without too much success though, for no Java team has up till now managed to beat the 4GL tools. This year, for the first time, a Rails team joined up. And not just any Rails team; my co-bloggers from “rubyenrails.nl“, Remco van ‘t Veer and Michiel de Mare were in it. Today the results from the contest were published, and guess what — Remco and Michiel came in second! They beat all the Java teams; first place was for the CrossmarX Application Engine. Congratulations to Remco and Michiel, and to Rails of course!!

2006-03-29. One response.

« Prev - Next »