- Posted by Shay Friedman on October 8, 2009
Everywhere I go and preach about IronRuby I come across .Net devs who don’t understand what’s in it for them. This time I’ve decided to take action and tell you all about what’s in it for you and why you should be as excited as I am about the upcoming IronRuby 1.0.
This post is written as a conversation between me and my imaginary .Net developer friend (don’t you have one too?). Enjoy!
Friend: Hey Shay, what is this IronRuby that you can’t stop talking about?
Me: Oh imaginary friend, finally you’re being productive! well, IronRuby is Microsoft’s implementation of the Ruby language which runs on top of the DLR. Its unique power, comparing to other Ruby implementations (MRI, JRuby…), is its ability to interop with .Net assemblies with ease.
Friend: So is it an entire new language?
Me: Ruby isn’t a new language, it’s been around since 1996. However, it is a new language for the .Net framework. It is the first time for Ruby to be a fully .Net language. As a result of IronRuby being a .Net language, just like you can run VB.Net from C# and C# from VB.Net, you can run C# from IronRuby and vice versa.
Friend: Why did Microsoft choose Ruby from all the languages out there?
Me: First of all, Ruby rocks! secondly, along with the development of the Dynamic Language Runtime (DLR), Microsoft decided to develop .Net implementations of Ruby and Python. These languages appear in the top 10 of programming languages (look here) and with these .Net implementations, Microsoft will open its doors to thousands of developers worldwide, who until now had no reason to take a look at the .Net framework.
Friend: What’s in it for Ruby developers? Why would they want to use IronRuby?
Me: For Ruby devs, using IronRuby means that they can use .Net framework frameworks like WCF, WPF, ASP.Net MVC, Silverlight and others. Even though there are many libraries and frameworks available in Ruby, Microsoft does have some killer frameworks which are hard to find elsewhere like Silverlight. Another advantage is the possibility to use Microsoft infrastructure. For example, running Ruby on Rails on IIS.
Friend: Ok, so if I want to use IronRuby, I need to learn Ruby, right?
Friend: But I don’t know the language!
Me: Just like many other .Net developers, you will need to learn the Ruby language in order to write IronRuby code. Do NOT be afraid. Ruby is an easy language to learn and I promise you that learning it will open your eyes to a whole new world (which might amaze you, beware!). When I was learning Ruby I was surprised time after time about its syntax and the fun feeling you have while coding. Moreover, learning another programming language is a good practice to increase your knowledge of programming in general (read my other post about how to increase code quality).
Friend: Assuming I have learned Ruby, the company I work for will never abandon C#/VB.Net for IronRuby.
Me: I agree, I don’t believe companies will stop using C# and start coding in IronRuby. It isn’t gonna happen. However, when companies realize the benefits of using IronRuby in different scenarios, you will start seeing IronRuby code over there.
Friend: How can a company benefit from using IronRuby?
Me: A lot. As I said, I don’t expect companies to change their core code to IronRuby. There’s no reason to do that. But, there are several other areas where you can use IronRuby – tests, POCs, automation, internal tools and more.
Friend: How can IronRuby improve my tests?
Me: IronRuby has incredible test frameworks. For me, Cucumber is a killer test framework. It’s one of the most brilliant frameworks I’ve run into. To make it possible for QA and product managers to write specs in a human-readable syntax and run them as tests afterwards is just astonishing. Ruby has other great and widely-used test frameworks like RSpec and even web test frameworks like Watir.
Friend: Sounds pretty promising I must say. And why did you say it was good for POCs?
Me: Ruby is a language that enables you to write code fast. This is why writing a POC in IronRuby will take less time to develop. Remember that when you develop in IronRuby, everything is a CLR object so it is almost like writing C#/VB.Net code. Once the IronRuby POC is done and the feature goes into production development, transferring the IronRuby code to C#/VB.Net is very easy (SharpDeveloper even has a feature that does the conversion automatically). Same goes for internal tools – you write the tools faster and continue with your other tasks (look at my first ever IronRuby post where I was excited how easy and fast it was to write a tool I needed) . By the way, writing in a different language from time to time can also be a breeze of fresh air and a great routine breaker.
Friend: Great! and what about automation?
Me: Ruby has Rake which is similar to Nant in concept, just uses Ruby syntax. Once you know Ruby, there is not need to learn Nant as well… just use Rake.
Friend: You make faces like there is more. Is there?
Me: Yes! Except all the great Ruby stuff, you can also use IronRuby from your static language code. This is great because it lets you extend your application in a very easy way (take a look at my post about the subject). Another thing, the DLR along with Silverlight gives client scripting a whole new life and makes it bearable (which is not an easy task at all). Take a look at the amazing Gestalt project for more about that.
Friend: Now let’s say I write something in IronRuby. How do I deploy it? is it hard?
Me: The deployment is a matter of seconds. It is actually just copy and paste. All you need in order to run IronRuby on a different machine is to copy the Dlls there.
Friend: Nice! Well, I’ve waited till now and here is the million dollar question – can I write IronRuby inside Visual Studio?
Me: Well, in the meantime - no. There is a voting going on to convince Microsoft to do that ASAP. However, there are some great Ruby IDEs (like NetBeans, RubyMine, SciTE and more) that you can use. There is also the Ruby-in-Steel Visual Studio addin which makes it possible to work on Ruby files inside Visual Studio (it doesn’t work with IronRuby yet, but it is included in their plans). These IDEs do not have the intellisense that you are used to in VS and C#, but they are good for the job. I must say, once you get familiar with the language, you don’t need intellisense anymore. Really.
Friend: You got me convinced! I want to start IronRubying!!!
Me: Awesome! You can start with http://IronRuby.net and download the latest IronRuby version from there. If you have any questions, make sure to check the IronRuby mailing list or contact me and I’ll do my best to help. By the way, IronRuby is currently in version 0.9.1 and will advance to version 1.0 in the next couple of months.
Friend: Thanks Shay! now I see what IronRuby gives me and I’m willing to give it a try!
Me: Glad I could help! see ya!
Readers, do you have any questions? post them as comments and I’ll address them as soon as I can.