Home > Articles > Programming > Ruby

IronRuby Unleashed: An Interview with Shay Friedman

  • Print
  • + Share This
Hal Fulton interviews Shay Friedman, the author of IronRuby Unleashed, about writing code at the age of 8, why IronRuby is much more than a bridge between .NET and Ruby, and why both Rubyists and .NET developers should use IronRuby.
From the author of

From the author of

Hal Fulton: Tell us about your background -- Ruby, .NET, other interesting career highlights?

Shay Friedman: I started to write code at the age of 8. I wrote DOS scripts that created convenient menus so I could execute my games more easily. Since I was 16, I've been working professionally. I started as a web developer using ColdFusion and ASP and then moved on and joined the Israeli Defense Forces (IDF) as a developer. At the beginning I used C++, but as soon as .NET 1.0 was out I moved on to develop C# and ASP.NET applications. After I finished my service, I joined Advantech's Microsoft division as a .NET developer and consultant. I worked on a few different projects. One of them was ActionBase, where I stayed and worked as a team leader creating an ASP.NET web application and office add-ins with .NET 2.0 and 3.5. During my work in ActionBase, about 2 years ago, I heard about the DLR -- the Dynamic Language Runtime -- that Microsoft had started to work on. One of the languages that Microsoft built on top of the DLR was IronRuby and as a result, I got into Ruby. Learning Ruby was jaw-dropping for me -- so many great concepts, so many possibilities. Since then I've been involved with the IronRuby community, helping with the mailing list, writing blog posts, speaking at public events -- everything to make .NET developers understand what I have found out -- Ruby is awesome! Currently I work in the Sela Group as a .NET consultant and instructor specializing in dynamic languages where I consult and instruct courses all over the world.

Hal: What exactly is IronRuby, first of all? Is it a Ruby-.NET bridge? A reimplementation of Ruby on top of .NET? Something else entirely?

Shay: IronRuby is a Ruby implementation that runs on top of the .NET framework. It is built on top of the .NET Dynamic Language Runtime (DLR), which in turn, is based on the .NET Common Language Runtime (CLR). The CLR was built with static languages in mind, so Microsoft took it one step farther and created the DLR, the Dynamic Language Runtime, which provides the needed services for dynamic languages, such as IronRuby and IronPython, that run on top of it. This architecture generates a wonderful result -- integration with any other CLR- and DLR-based language like C#, VB.NET and IronPython. But that's not all. IronRuby’s goal was to provide seamless integration with .NET objects. After some hard work by the IronRuby team, the result is fantastic. Via a simple require statement, you can use any .NET assembly from Ruby code. Moreover, since .NET static languages have different naming conventions, the IronRuby team has added a "name mangling" feature that allows calling .NET methods in Ruby naming conventions (for example, GetName will be converted to get_name). Currently IronRuby is in RC2 state and passes 86% of RubySpec, with 98% of the language spec. The performance, according to recent benchmarks is excellent -- more than two times faster (some say even four times faster) than the popular Ruby implementation, MRI. These statistics put IronRuby in a great position to become the primary Ruby implementation for Windows (even though it is also supported by the Mono project -- not officially though).

Hal: How does IronRuby compare with past projects such as a Ruby-to-.NET "bridge"?

Shay: IronRuby is much more than a bridge between .NET and Ruby. For example, as a result of the .NET framework architecture, IronRuby code is eventually written on top of the CLR (Common Language Runtime). Consequently, IronRuby code is converted to CIL, then to machine code and eventually gets executed on the target machine. This generates a wonderful result -- since all .NET languages end up as CIL, it is possible to share code between languages -- for example, execute IronPython libraries from IronRuby and vice versa. Have you ever considered using Django from Ruby code or Ruby on Rails from Python code? It is now possible with the DLR. IronRuby code, like any other code in the .NET framework, is first converted to CIL and then is converted to machine code by the JIT, and gets executed on the target machine. You can execute IL code in IronRuby directly by using .NET's Reflection.Emit method.

Hal: How mature, how usable is IronRuby?

Shay: Since IronRuby hasn't been released yet (release is planned in the next few months), there is no big project that uses IronRuby currently. I guess that only after version 1.0 is out will we be able to tell whether IronRuby is a success or a failure.

Hal: Suppose Rubyists are unfamiliar with .NET -- why should we care about it?

Shay: For Rubyists, IronRuby is an opportunity to use the great .NET frameworks like WPF, which is an incredible user interface framework, and Silverlight, which is an RIA (Rich Internet Application) framework that gains more popularity by the minute. These frameworks and others can be exploited almost seamlessly from Ruby code via IronRuby. In addition, IronRuby runs Ruby on Rails applications, and because of the natural integration of IIS and .NET, IronRuby makes a great choice whenever you need to deploy your RoR application to an IIS server.

Hal: Conversely, suppose a .NET coder has never tried Ruby -- offer that person an elevator pitch as well.

Shay: .NET developers have so much to gain from IronRuby. Just like my Ruby experience was jaw-dropping, any .NET developer will be amazed on how fun and powerful Ruby programming is. In a more practical perspective, IronRuby can be used for several different everyday tasks of the .NET developer. These include extending .NET applications with ease, writing internal tools and POCs faster, and taking advantage of Ruby's amazing test frameworks to test .NET code.

Hal: When you constructed this book, were you thinking of it as a reference, a tutorial, or in some other way entirely?

Shay: The book was constructed as a mix. Some parts, like The Ruby Language (2nd part) and IronRuby Fundamentals (3rd part), have been written as a reference so you can go and look there whenever a question pops up. However, the fourth part, which goes over several .NET and Ruby frameworks and shows how to take advantage of them via IronRuby, has been written in a more tutorial way. If I were to write a reference about each technology, the book would have become an encyclopedia.

Hal: Why "iron," by the way? Was IronPython the first to use this adjective?

Shay: Actually, "iron" is an acronym for "Implementation Running on .NET." I have no idea who used it first, though.

Hal: What did you learn while writing this book?

Shay: I learned so much. Writing a book really takes you to a mastership level. You must go into details, you must write about the bits and bytes, because there is a chance that someone out there will want this information. All in all, writing IronRuby Unleashed was a great experience -- exhausting but very, very satisfying.

  • + Share This
  • 🔖 Save To Your Account