IronRuby = (Ruby + .NET)!

IronRuby is out in the open! And I’m digging it!

If you have been reading my most recent posts, you’ll see that I’ve recently started getting into Ruby. Partly that’s due to attending and speaking at eRubyCon but I wouldn’t have gone to that conference had I not been interested in the technologies. I had first seen some of Ruby when I met John Lam at VSLive Toronto in 2006. He did a keynote talking about languages with Ruby being his language of choice. It was a thought provoking talk but I didn’t quite get it. At some point, I started noticing Scott Hanselman start talking about using some of the testing tools in Ruby such as Watir. This intrigued me but I really didn’t start getting interested in Ruby until I met Joe O’Brien when he did a session at CodeMash 2007. I really didn’t have a chance to play with Ruby until I signed up to talk at eRubyCon and deliberately picked a topic that would require that I learn some Ruby. I probably could have just done a talk on Silverlight as a web front end and danced around the interop questions but I wanted to do something a little more substantial. The end result was that I wrote a Ruby on Rails app that serves up a Silverlight front end that then turned around and asked for JSON objects from the Rails back end. This was a cool demo! Ok – I didn’t get a standing ovation but I thought it was fantastic and well received. In the process, I picked up a copy of Dave Thomas’ Agile Ruby on Rails Development (See below) on a suggestion by Joe. it turned out to be a great book that walked through some very practical examples and labs. It was fantastically easy to toss together a site with InstantRails following Dave’s tutorial. (I’m still reserving judgement on Ruby On Rails as a framework. There are some things that I really like about it and some that I really don’t. I need to spend more time looking at it and separate it from Ruby and decide on the framework’s attributes independently of Ruby.)

Glenn VanderburgI was asked this week by a fellow Architect Evangelist what I liked about Ruby as I kept babbling on about it. The easiest thing that I can do is point out Glenn Vanderburg‘s “The Beauty of Ruby”. The whole talk is online. He did a variant of this talk at eRubyCon. He points out a handful of high level things that really make Ruby a fantastic language. Ruby is a fantastic blend between simple elegance and rock your world unbelievable power. It has a very clean but flexible syntax. There is just enough punctuation to make things readable without requiring a lot of extra bits. Another powerful bit that took a while to get my head around is that everything is an object from class declarations to instances to methods to variables to everything. And you can ask just about everything questions about itself, ask it to do stuff or pass it around and into new contexts. I’ve been enamored of .NET’s Reflection with it’s ability to self inspect and dynamically figure out context at runtime but I had no idea how powerful this type of work could be until I saw Ruby’s meta programming layers. The metaphor that I used to explain this to a friend is that you can walk into a dark room and bump into someone and simply by asking them questions, you can turn on all the lights and see what’s around you. That’s the feel that I get from Ruby and it’s extremely powerful self inspection. There are a lot more things that are interesting about Ruby but those two things – the simple but flexible syntax and the extremely powerful meta programming – are the heart of what I like about it right now.

Now that we have an IronRuby implementation that we can start playing with, I’m even more excited about it. This means that I’ll have all the power of .NET at my fingertips with the power of Ruby. This makes for a very attractive package. Being build on top of the DLR (Dynamic Language Runtime) is very important as well because does two things. One, it enhances the Ruby implementation and two it enhances the DLR implementation. Scott Guthrie talks a little bit about the idea of “Dynamic Sites” which is a cashing mechanism from the DLR that IronRuby takes advantage of. However, John Lam talks about on his .NET Rocks episode about the DLR that they found and fixed bugs in the DLR. Through the DLR, we are going to have a fantastic dynamic type system. This type system allows all of the languages of .NET, dynamic and static, to share common types without having to do translations back and forth. There are a number of things that it doesn’t do yet, the most notable being that it doesn’t implement interfaces yet. This is not a big deal to Ruby and Python, but it is a big deal to VB.NET and C#. I know that this is coming – it’s just a matter of time. Jim Hugunin talks a lot about the DLR and the type system on this blog.

What’s missing right now from Ruby is tooling. I’ll admit it, I’m still addicted to my “intelli-crack” and there are not a lot of great IDEs for Ruby that include intellisense. It’s hard to get right because of the dynamic nature. There are some tools that are out there, but not any that really get it right. Most of the people in the Ruby community don’t worry about the tools – in fact there was a huge argument over whether VI or Emacs was a better editor for Ruby (Emacs won…). I’ll be honest – I was a little blown away that this is still a conversation.

RubyForgeOne interesting part of the IronRuby implementation and release is that John has make the decision to release IronRuby on RubyForge rather than CodePlex. Scott Guthrie talks about this on his blog. John decided that there would be a lot more community involvement with IronRuby if he did it on RubyForge than on a Microsoft property. I think this is a smart move that shows some dedication to making this a true community driven initiative. I say bravo John!

 

Additional Reading:

John Lam, who is the architect of Iron Ruby who wrote A First Look at IronRuby

Scott Guthrie, who has a nice sample on using IronRuby with WPF

Jason Zander, on working with the open source community

Miguel de Icaza, for an outside perspective of our changes as a company

 

Leave a Reply

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