Community Highlights: IronRuby

Posted by Matt Aimonetti August 11, 2009 @ 04:19 PM

As Rubyists migrate from Ruby 1.8 to Ruby 1.9, new Ruby implementations are gaining in maturity. Recently, IBM's Antonio Cangiano wrote an interesting article comparing the performance between Ruby 1.8, 1.9 and IronRuby on Windows which surprised quite a lot of people.

Unfortunately, IronRuby isn't very well known in the Rails community yet.

Here is an interview with Jimmy Schementi, lead developer for IronRuby, to help give you a little insight.

iron ruby logo

Matt: Hi Jimmy, thank you very much for taking the time to answer our questions. Could you please introduce yourself?
Jimmy: Thanks for sending me questions; it's great to see the ever-increasing interest in IronRuby! I live in Seattle and work at Microsoft on a small team making an open-source implementation of Ruby called "IronRuby". I personally split my efforts between making the IronRuby codebase better, integrating IronRuby with .NET-related technologies like Silverlight or ASP.NET MVC, getting our monthly binary releases are in order, discussing IronRuby with the community, and making sure Microsoft's management knows how awesome Ruby is. But I'm definitely not alone on the core team. John Lam fueled the interest of a .NET-Ruby implementation with the RubyCLR project, and started the IronRuby project. Tomas Matousek is the brains behind the IronRuby compiler, and gets credit for all the compiler code and the recent performance gains. Jim Deville is the man keeping IronRuby working with tons of tests and a fantastic test infrastructure. Shri Borde is our manager, and he spends his non-managing time fixing the libraries and hosting the infamous "IronRuby pair-programming" sessions. And of course all the IronRuby contributors over the past two years have been an enormous help.
Matt: As a follow up on a recent blog post, could you tell us know how you learned Ruby and maybe give some advice or an important point not to miss for people wanting to learn Ruby?
Jimmy: I heard about Ruby from my Computer Science professor/advisor Gary Pollice, who taught all the programming language classes at Worcester Polytechnic Institute. I was searching for an expressive programming language for making games, and Ruby was a perfect fit. A couple years later I worked for the same university building a computer-tutoring system called Assistment, where myself and a couple of other people fed up with the Java codebase ported it to Ruby on Rails. It was a success, and http://assistment.org is now a Rails system. That's where I really learned everything about Ruby and became extremely interested in how Ruby worked. I learned the most from Ruby when I had a substantial Ruby project to work on, since I got to see its expressiveness making me more productive on a large scale. I'd still suggest trying to learn Ruby on small things here and there, but you'll really be amazed if you use it for something larger.
Matt: IronRuby certainly looks very interesting, can you run Rails on it?
Jimmy: Yes, at RailsConf 2009 I showed IronRuby running non-trivial Rails applications. IronRuby can run Rails on WEBrick, as well as on the web-server that comes with Windows, IIS. For the database you can use SQLServer Express (which is free), or any .NET based database, like the recent csharp-sqlite port. Here's a detailed post the IronRuby on Rails talk at RailsConf 2009: http://blog.jimmy.schementi.com/2009/05/ironruby-at-railsconf-2009.html.
Matt: Are there any limitations that our readers should be aware of before starting to develop on IronRuby?
Jimmy: The main limitation is that IronRuby does not support any of the C-based Ruby libraries, and only after 1.0 will we consider building an interop layer between the Ruby C API and IronRuby. In the meantime, people have been porting their favorite C-based Ruby libraries over to C# so it can be used from IronRuby, like Hpricot. While this seems like a large limitation, most of the C-based libraries Ruby code depends on have an equivalent API in the .NET framework, which IronRuby has direct integration with, making either using directly or porting really easy. For example, the Rails app I showed at RailsConf did image resizing directly with the System.Windows.Drawing APIs rather than ImageMagick. If your code does not depend on anything outside of the Ruby standard library that is C-based, you should have no problems. Take a look at the documentation for running Rails on IronRuby to make sure things go smoothly: http://ironruby.net/Documentation/Rails.
Matt: What are the pros/cons of using IronRuby versus the standard Ruby (Ruby1.8 or Ruby1.9) on Windows?
Jimmy: IronRuby is a very fast Ruby interpreter/compiler due to our own tricks we pull to make Ruby fast, the tricks the DLR does to make dynamic languages fast, and the CLR's just-in-time compiler which generates very efficient code. We're definitely aiming to be the fastest Ruby implementation on Windows. The most recent performance work we did was only in the core libraries ("Array", "Hash", etc), and that helped IronRuby surpass Ruby 1.8.6 on Windows and gets much closer to Ruby 1.9.1. IronRuby is continuing to investigate ways of gaining performance in each release. IronRuby is also a very 1.8.6 compliant Ruby implementation. There is a "-19" flag for any 1.9 specific features you might need, and a "-20" flag for any Ruby 2.0 features we might have in there, but there are no guarantees on those; we only test the 1.8.6 behavior today. We pass ~85% of the RubySpec test suite, the best test suite for Ruby implementations to verify their correctness. However, the numbers I'm more concerned with are whether specific Ruby libraries' test-suites work. We pass Rails, RubyGems, Rake, and RSpec's test suites at well over 90%, and fix compatibility issues when asked about them, so please let us know if your applications run into any compatibility problems. Other than the limitations that I mentioned in the previous question, you should have no problems. I love people to try running their Rails applications on the latest IronRuby bits hosted on GitHub, and please report any issues you find on http://ironruby.codeplex.com.
Matt: Are they any extra advantages to use IronRuby?
Jimmy: The most notable advantage is that IronRuby works in Silverlight, a subset of the .NET framework which installs as a browser plugin in Mozilla-based browsers (eg. Firefox on Mac and Windows), Webkit-based browsers (eg. Safari on Windows), and IE (on Windows, duh). The Mono project is implementing an open-source version of Silverlight called "Moonlight" so Linux developers can run Silverlight applications, which I talked about at OSCON 2009. This enables you to write Ruby in the browser instead of JavaScript, for controlling HTML or vector graphics. The best place for documentation/examples today is on the Gestalt website, a little portal designed to bring awareness to Ruby and Python in Silverlight: http://visitmix.com/labs/gestalt. The IronRuby website is in flux at the moment, but clearer documentation is on its way. I also built a little Ruby on Rails plugin called "Silverline" to make it really easy to use Silverlight from Rails. Worth checking out if you want to use Ruby as a client scripting language. IronRuby has direct integration with the .NET framework, so anything that is in, or run on, the .NET framework can be used directly from IronRuby. .NET namespaces are exposed as Ruby modules, .NET classes as Ruby classes, and you can call methods on them just like you call Ruby methods. This makes it really easy to build pieces of your system in a static language (if it makes sense to use, like for a high-performance message queue, game engine, etc) and then interact with it through Ruby.
Matt: Why is Microsoft interested in a Ruby project? What advantage do they find in sponsoring such a project?
Jimmy: I see it as a "you scratch my back, I'll scratch yours" situation. Microsoft sponsoring IronRuby helps the Ruby community by making Ruby a first-class language on Windows and .NET, also giving the .NET crowd the choice of using Ruby, and in return the IronRuby project helps promote innovation in the languages that drive Visual Studio purchases (C#, VB.NET, and F#). As a kind-of related side-note: some people feel it's a bad thing that there are so many implementations of Ruby, kind of like MRI is so bad that others had to fix it, but I completely disagree. IronRuby, JRuby, MacRuby, and most of the other implementations accomplish the same thing for their respective communities; building a bridge between Ruby developers and themselves. Rather than needing to recreate MRI, most have been inspired by it and wanted to bring the language to their platform. It's a great thing for the Ruby community because it gives access to more platforms, operating systems, and libraries than any other language. Anyway, back to the question: as an example of how IronRuby has helped language innovation, the next version of C# will now have a "dynamic" keyword, indicating that the variable statically-typed as "dynamic" (=P) should perform dynamic dispatch on any method calls, rather than verify the method call at compile-time. This infrastructure uses the Dynamic Language Runtime directly, so C# can use Ruby objects just like they were defined in C#, or any other dynamic-enabled object.
Matt: How will IronRuby make Rails developer lives easier and what are the plans for the future of IronRuby?
Jimmy: My hope is that IronRuby can benefit existing Rails developers by making Windows a great option to develop and deploy on. By building a Rack adapter specifically for IronRuby and IIS (like I showed at RailsConf), Rails applications can tie directly into the same web-server pipeline that ASP.NET does, significantly reducing the overhead deploying via IIS+FCGI gives you today. This makes deploying Rails applications on IIS just like deploying ASP.NET apps, so system administrators don't have to learn a whole new framework; to them it's just ASP.NET. Then any existing ASP.NET shops who want to offer Rails applications to their customers can, with the same infrastructure and deployment know-how. This is bringing choice to the technologies you choose to deploy on Windows, just like how Microsoft has helped make PHP run well on IIS. The only definite future plans for IronRuby is continue pushing on performance on compatibility, as well as continue supporting the latest version of Silverlight and Mono. 1.0 will be released when the community is happy with the state of those metrics, and future work should be driven by what IronRuby users want. If you start using IronRuby and want a feature either by 1.0 or post 1.0, please post the request to the mailing list or to CodePlex. We have tons of hopes and dreams for what IronRuby can do in the future, so please come help out!
Matt: Is there anything you would like to add or share with the readers?
Jimmy: Thanks to Matt for the interview, and thanks to the readers for getting this far! Go grab the 0.9 release from http://ironruby.net/download, or the latest source from http://github.com/ironruby/ironruby, tell us if you have any problems with it, and we hope you'll help IronRuby get to a 1.0 release.

Posted in Activism | 16 comments

Comments

  1. Patcito on 11 Aug 16:48:

    Thanks but no thanks, I’ll stay on my kubuntu :)

  2. Matt Aimonetti on 11 Aug 16:57:

    @patcito The goal of IronRuby isn’t to get people to move to Windows, it’s to offer a better Ruby for people on Windows or having to develop for the Microsoft platform. I’m not on Windows either but next time I have to work on a Windows centric project, I’ll be glad to use my favorite programming language ;) Furthermore, developing and hosting Rails app on Windows is important for a lot of people, it’s great to see people stepping up and making that a reality.

    - Matt

  3. PanosJee on 11 Aug 17:18:

    That ’s great news, i had to abandon a rails project once because the organisation where i was working was a Windows shop and the admins had no idea and were not so cheerful to support a new platform but with IronRuby that would be trivial, the same happens with JRuby. All these implementations make us one of the few developers that can make and deploy apps in almost all platforms now being J2EE, Windows or pure UNIX environments

  4. Patcito on 11 Aug 17:53:

    @Matt: Fair enough, but I really hope people don’t start writing silverlight apps with ruby in them. We’re just starting to see the end of the tunnel for flash thanks to HTML5. Let’s not switch to another crappy solution like silverlight. And what’s wrong JS and jquery and others?

    Browsers already have a hard time with writing compatible JS interpreters, let’s not through ruby in there :)

  5. Ben Johnson on 11 Aug 19:47:

    Why take something so good and throw it on a platform that is so bad? When it comes to development I wouldn’t touch Windows with a 10 foot pole. In my opinion it’s not even worth the effort. Correct me if I’m wrong, but wouldn’t it be more cost effective from a resource standpoint to just buy a server with linux on it and have the apps communicate via services? Not to mention the other huge list of advantages that using linux offers.

    I’m not trying to be a debbie downer, but why go against the grain with this?

  6. Josiah on 11 Aug 21:07:

    @Ben

    If you have the privilege of being paid to work in a Linux environment, then it’s hard to see the point.

    However, there are many of us that love Rails, but are stuck working for a corporation that is completely Windows-based. You can’t just “buy a server with linux”; Do you have any idea how IT people in a large corporation are? It’s not even an option. I really cannot stress that enough – they would laugh in your face.

    This finally gives us a solution – a glass of ice water in hell.

  7. Matt Aimonetti on 12 Aug 01:24:

    @Ben I’m sure you are aware that Ruby and Rails are now being used by a lot of people and some might have some legacy code in .NET, Java, Objective-C etc…

    Furthermore, some people have a different background than yours and might enjoy their IIS environment, others don’t have a choice.

    Even tho, a great majority of Ruby and Rails developers are on Linux/Mac, it would be very wrong to not encourage projects like IronRubuy, JRuby or MacRuby.

    People have been complaining about Microsoft for ages, but look, they are trying to do something great! I can tell you that the Rails team is working with all Ruby implementers trying to run Rails.

    Also, just so you know we are also supporting work done on Oracle integration and other database systems that are not so popular in the Rails community.

    Having a better Ruby on Windows would help the entire community and that’s what matters.

  8. RailsGirl on 12 Aug 05:23:

    Hi, I was expecting few lines of discussion on Asp.Net MVC with IronRuby as a sideline reference. It seems this topic was totally ignored. Can you update this blog a bit..?

  9. Petros Amiridis on 12 Aug 16:33:

    There is always fear when everything changes rapidly and things have not settled down. Choosing whether to learn a new technology or not, is difficult.

    That said, I am very glad, as a Ruby programmer, when I can use Ruby in as many places as possible.

  10. Diego on 13 Aug 05:05:

    Thanks but I prefer the C runtime in Ruby 1.9.x.

  11. Diego on 13 Aug 05:07:

    Thanks, but I prefer the C runtime in Ruby 1.9.x.

    I agree with Ben Johnson too.

    Linux++

    Windows—

  12. Ben Johnson on 13 Aug 15:20:

    @Josiah yes, I work with large corporations every day, they are my clients. Most of them have a mix of windows and linux servers. So asking them to use linux is not a big deal. Also, I have said “let’s buy another linux server” and they bought it that day. They didn’t laugh in my face. The only time I’ve ever got any push back on that was with a smaller company where buying a server is a much bigger deal.

    Anyways, I agree, if for some reason I was stuck with Windows only, then I would probably consider IronRuby. But I would try just about every other option first.

    I’m just trying to be realistic. The costs seem to outweigh the benefits, but maybe I am out of touch with the demand for ruby on a windows environment.

  13. MySchizoBuddy on 17 Aug 10:59:

    So i have to now learn .NET as well? to make the most of ironRuby.

  14. tomy on 22 Aug 06:29:

    good post

  15. Mark on 27 Aug 06:10:

    @Ben there are windows only shops out there. Just because you haven’t worked with them, doesn’t mean they don’t exist. (In fact there are quite a few of them).

    In windows only environments, the SysAdmins are generally afraid of linux. They don’t want to mess with the command line at all. Frequently, the cost of hiring a linux admin is higher than a windows admin. So the TCO of adding linux technologies to an organization isn’t always less.

    In windows only shops products like IronRuby & IronPython can be a big win in that developers can use these technologies without really adding to their operations budget.

    Also I’m pretty stoked that Microsoft is buying into F/OSS, even if only with a few technologies. Hopefully this extends into other areas as well.

    Lastly, anything that spreads the penetration of Ruby is a good thing. It means more jobs and more money for Ruby developers.

  16. Sri on 28 Aug 19:53:

    IronRuby certainly creates great options for .net developers as well as Ruby developers. It opens up the door for dynamic languages on .net environment as well most of the awesome ruby code that can be ported with a simple re-compile of the source in Visual Studio. If you dont understand why there is a new upcomming platform/language then instead of reiterating your ignorance, open up your mind and see the possibilities and avenues of leveraging the technology. Just like Java is not for me does not make it insignificant and unimportant. I am .net developer using C# for most of my professional life and like Ruby as a language and would like to use it. So, IronRuby is for me.