Rambling about programming and life as a programmer

Archive for November, 2007

Culture shock

Posted by webmat on November 16, 2007

Update: This article has has a new home on Go to the article.
Comments are closed here but still open there :-)

I had a bit of a culture shock a couple of days ago. I saw a video of the visual designer for IronRuby, named SapphireSteel. The tool looks very nice and polished.

Something unsettled me, however, when I saw it. It has nothing to do with the team or what the narrator says. In the demo, he shows us a couple of features of the designer, and inevitably we end up seeing snippets of code. That’s when the culture shock, uhh, shocked me.

I’ve seen plenty of verbose code in my time. I even work in C# right now, which I find errs on the side of verbosity. So I’m used to seeing verbose code, and I’m certainly used to see WinForms code.

But seeing this WinForms code in Ruby felt very weird.

WinForms in Ruby is Still WinForms

WinForms code in Ruby is still exactly as verbose as in C#. Only the semicolons are missing.

C# colleagues might tell me that this code just satisfies what the API wants to hear, in the way it wants to hear it. But I’m getting used really fast of the Ruby way of doing things. Which consists “sane defaults” for a start, and using DSLs to solve complex problems in a declarative manner rather than in an imperative manner.

WinForms development with Ruby screams for a Rubyish wrapper. Anybody up for that? If it can be done for Java’s Swing (with Profligacy, the Swing reducer), it can certainly be done for WinForms.

For my part, however, I’d be much more interested in exploring XAML with Ruby, but that’s another story.


Posted in programming, ruby-rails, windows | Tagged: | Leave a Comment »

Follow-up on my presentation on JRuby

Posted by webmat on November 8, 2007

Me, gesticulating vehemently

Update: This article has has a new home on Go to the article.
Comments are closed here but still open there :-)

I’m very pleased! My presentation went very well, the audience was very receptive. We had some great questions and interactions during the talk. Great fun! Here we can see my neck-twisting setup and me, gesticulating vehemently.

So if you want to check the presentation again for some reason, here it is: JRuby – On and off Rails. Also available is my take on Nick Sieger’s, Rails performance numbers.

I suppose some of you might be interested in my other references, as well. So here’s a recap of the links I mentioned at the end of the presentation.

The people

Charles Oliver Nutter works for Sun, he’s the main driving force behind the compiler, among other things. If you’re interested to hear about easy bugs to fix in JRuby, he posts a list once in a while.

Ola Bini works for Thoughtworks and he also works on JRuby full time. His recent feats include speeding up the regex implementation of JRuby.

Nick Sieger also works for Sun, but his job is on the user end of JRuby. He contributes to JRuby as well, however. And by the way, check out the follow-up on the talk he and his team gave at RailsConf. The article discusses implementing some parts of the model of his application as RESTful services, thus giving them more flexibility for scaling. The WAR file deployment approach is mentioned as a tool that helps manage all those independent Rails instances.

Last but not least, Thomas Enebo, also hired by Sun to work full time on JRuby. During the presentation I mentioned that his blog was less technical than the other guys. Turns out this feeling was largely based on the activity on his blog before summer. Recently he posted some very interesting posts on JRuby and Ruby. Looks like I have some catching up to do :-)

The project

The official JRuby site is hosted on codehaus. While the official wiki is on Charles Nutter’s personal site for now.

JRuby on Rails

For 2 good tutorials that take you through the steps of trying out JRuby, go see on ADS’ blog:

Getting JRuby and Rails running. Deploying to Glassfish. Theirs posts are pretty detailed, but since things are moving so fast in the JRuby world, some of the details are a bit out of date already :-) In it they use Goldspike to generate their WAR archive, just like I did.
As I mentioned however, a post by Nick Sieger introduced me to warbler as another very promising replacement to Goldspike. In fact, as Nick describes warbler, I fully expect to try it and stick with it instead of Goldspike. Definitely worth a try.

Check out the Glassfish gem for a better integration of Glassfish in your Rails workflow. I haven’t tried it yet, so I can’t elaborate on it.

The 2 Java web servers I used are:

Jetty, the small, unintrusive yet very scalable web server. I likened it to WEBrick in that it can be used to try out our WAR file with absolutely no fuss. Which is not to say that it can’t be used in a production setting.

Glassfish, the full-featured server with the admin interface. This is the server that ended up being about as fast as the MRI/Mongrel combination, in the performance comparison.

If you’re interested in a JRuby/Mongrel setup, the one which ended up being the fastest in the comparison, check out this post*, mentioned by Nick Sieger, and this post by Ola Bini.

JRuby off Rails

For those that were insterested in the non Rails bits as well, I talked about an unintrusive plugin that allows you to create Swing gui apps, I mentioned (and stumbled over the name of) Profligacy. It’s been created by Zed Shaw, the creator of Mongrel.

I also talked about using JNA to reuse existing C extensions for Ruby, which do not have a JRuby equivalent yet.

I have to stop and go to work now

Hey, I wanted to make this a short post. Looks like I failed :-) If I forgot something of if you have questions, don’t hesitate to comment. I’ll get back to you and update this post, if necessary.

As for me, I might help Carl by checking out whether JRuby could be a good fit for Defensio. I’m looking forward to that, I think it’s a great real world project to dive into JRuby head on. Of course I’ll report back and contribute, based on my findings.

*Sorry, the JRuby/Mongrel link seems dead as I’m posting this. I leave the link in case the problem is temporary.

Posted in garbage out, ruby-rails | 1 Comment »

Mat mini

Posted by webmat on November 5, 2007

Update: This article has has a new home on Go to the article.
Comments are closed here but still open there :-)

Good news everyone*!

Tomorrow my presentation at Montreal on Rails is going to be made on my brand new Mac Mini!

In my last post I mentioned I was going to present on an ooooold Win XP laptop, but I decided to make the switch to the Mac world now. Well, one week ago. So fear not, I’m not going to subject our community to a 5 square meters XP/Powerpoint eye bleeding festival.

The Apple world had one little surprise for me, however. Immediately after I bought my Mini I started hearing about the Java 1.6 debacle on Leopard. What? I didn’t event know OS X didn’t come with the standard Java distribution! And here I am, about to make a presentation on JRuby on a Mac :-) Note to self: never switch to a completely new OS (to me) one week before a presentation again.

This won’t affect the presentation, however, since everything works perfectly fine on Java 1.5, preinstalled on Leopard. And isn’t it reasonable to expect Apple to release Java 1.6 shortly anyway? So for those I’ll convince to give JRuby a try, all hope is not lost. Moreover, for the Rails community I think the Java 1.6 story is pretty much a non-issue. Your test and production servers are running on Linux, right?

So with that out of the way, there’s only one bump left in the road. As our host Fred pointed out to me, my mini has only one video out. Doh! I didn’t find any VGA or DVI splitter, so I’ll deal with it. This will be a bit of a pain in the neck, but hopefully just for me :-) Let’s see how the live coding part goes!

* In my best Professor Farnsworth voice (from Futurama)

Posted in ruby-rails | Tagged: | 2 Comments »