Archive for the ‘Ruby’ Category
As you may have noticed, IronRuby 1.0 was released earlier this week. I downloaded the .NET 4.0 version and headed to the Samples folder – in there, I noticed, is a Tutorial folder. There’s a file called tutorial.bat, so I opened a command line in that folder and ran the batch file. And I was impressed to be presented with an IronRuby Tutorial:
There are three tutorial options available: an IronRuby Hosting Tutorial; an IronRuby Tutorial and a Try Ruby Tutorial.
So, if you’ve been meaning to get to grips with IronRuby, these tutorials could be just what you’ve been waiting for.
As Matt announced, the slides from the Architect Insight Conference 2009 are all now online. The keynote videos are there too. As Marc notes, there’s something there for most architectural interests – including my session on Dynamic Languages and Architecture (with what could become my trademark use of translucent black.)
I know it’s Friday, but it’s a shame to waste a good title. ..
I thought this article by Martin Fowler about the use of Ruby at Thoughtworks was interesting. Right at the end there’s an insight into how valuable Ironruby will be to Thoughtworks. Speaking of Martin Fowler and dynamic languages, it’s also worth checking this post out – it contains some empirical data about how often Thoughtworks developers have to do type checks in Ruby.
Having posted how to use .NET classes in IronPython, I thought I should repeat the exercise in IronRuby. I figured I’d use the same assembly I built for the IronPython example. To start IronRuby (which, again, I’m assuming you have already installed) type ir at a command prompt. You should see something like this:
First thing is to require the SampleClasses assembly. Here’s how:
and you should the following output:
Let’s import the namespace:
and the output this time should be:
Next, create an instance of the User class:
>>>a = User.new
which should lead to this reponse:
Time to set a property:
>>>a.Name = ‘Bob’
and you’ll see that worked from the response:
Of course, you can check if you like:
which will duly report that our user is called Bob:
It really is that easy. Now you can go and have some fun with IronRuby and .NET assemblies.
IronRuby 0.5 was released last week – you can get it here. Read Jimmy Schementi’s post for more info – I’d also recommend that you read his post about his presentation at RailsConf 2009. For those of you exploring .NET 4, there’s a CTP of IronRuby available here (this version is roughly equivalent to the IronRuby 0.3 release. ) Having downloaded IronRuby 0.5, I set about following these instructions to run IronRuby on Rails – this is a sign of the progress that IronRuby is making. It’s worth pointing out that there’s some info about deploying Ruby web apps via IIS and Rack in Jimmy’s RailsConf 2009 post. Also released last week was version 0.91 of the DLR, which you can grab here.
Thanks to all of you who attended my session at AIC earlier today. The slides will be made available on line over the next week or so.
I think the interesting capability made possible by the DLR is using static languages and dynamic languages together. And there’s another benefit of learning a new language: when we only use one language we tend to think in that language – having other languages in our toolkit means that we have other approaches available to us.
So, where can you start to take advantage of dynamic languages? The areas I discussed today were:
- extending your application by adding scripting support to your application
- configuring your application with a dynamic language
- creating a DSL using a dynamic language
- writing one or more layers of your architecture in a dynamic language
- testing your application(s) with a dynamic language
Of all of these, extending and testing are probably the best places to start.
I also talked a bit about the DLR (and a couple of the Iron Languages – Iron Python and Iron Ruby) and the way that C# will be taking advantage of the DLR. It’s fascinating to see the evolution of programming languages and how the trends of dynamic, functional and concurrent programming are influencing this evolution.
Here are the links that I gave out in my session:
•Dynamic Languages on .NET (www.microsoftpdc.com)
I also mentioned the Anders Hejlsberg session on the future of C# – you can watch that here – and a Channel 9 video of Anders Hejlsberg and Gilad Bracha discussing language design, which you can find here.
As part of the preparation for the session, I exchanged some emails with a few folks including Michael Foord. For those of you who’d like to see Michael’s take on this subject, he’s posted about it here.
This Friday the fourth annual Architect Insight Conference will roll into town – this year the town is London. I’ll be speaking about dynamic languages from an architectural perspective and how and when you can incorporate them into your architecture.