JRuby evening @ Stroom Hotel Rotterdam

Yesterday evening I went to the JRuby talk organized by Finalist at the Stroom Hotel in Rotterdam. The presentation (by JRuby gurus Charles O. Nutter and Tom Enebo) was quite similar to the presentation they gave at Javapolis but with some juicy additions.

To get an idea of what is possible with JRuby just download the latest release from codehause: http://dist.codehaus.org/jruby/
. Unpacking gives you a directory containing some ready to run binaries like ‘jruby’ and ‘jirb’. They are drop-in replacements for the c-version counterparts.

Now, if you start jirb you can do something like this:
[ruby]
irb(main):009:0> require ‘java’
irb(main):009:0> frame = javax.swing.JFrame.new(“my frame”)
irb(main):009:0> frame.size( 300, 300 )
irb(main):009:0> frame.add(javax.swing.JButton.new(“click me”))
irb(main):009:0> frame.show
[/ruby]

And you get a swing frame! How cool is that!

Of coarse something like the above is still quite javaish, so Charles showed us a small DSL he wrote for swing (DSL = Domain Specific Language).

Using this DSL one can do something like this:

[ruby]
sw = SwingBuilder.new

frame = sw.frame(“My Frame”) {
layout :flow
button(“A Button”)
text_field(“A Text Field”)
set_size 500, 500
always_on_top = true
}

frame.show
[/ruby]

Even better!

Next to the above Charles and Thomas demoed a running version of Rails in Glassfish (Suns’ java application server) and calling into JNDI to access ejbs. And last but not least they gave an impressive demo of a more advanced version of jirb which is part of Netbeans and which is partly is available as webstart application:

http://www.bloglines.com/blog/ThomasEEnebo?id=24

Since a lot of exciting scripting stuff like this is happening in the Java world at the moment we (My colleague CTO and me) decided to send out an internal RFP for R&D projects investigating scripting as a mean to improve agility and productivity in our day jobs. Now let’s home something useful will come up!

This entry was posted in java, jruby, rails, ruby. Bookmark the permalink.

One Response to JRuby evening @ Stroom Hotel Rotterdam

  1. Pingback: Proficts’ Javasummercamp on Rails/Grails/Java at log4p

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>