Category Archives: DLR

.NET Coffee Break Show on IronRuby and Silverlight

I was just on a cool webcast called the .NET Coffee Break Show. I did a short show on getting started with IronRuby and Silverlight.

Because the show is supposed to be just 30 minutes or so, I didn’t get into my usual preaching about the Ruby programming language or why people should use a dynamic language. Instead I just stated the fact that I really like Ruby and I really like Silverlight and I especially like the combination of the two.

To get started with IronRuby, check out the getting started guide with IronRuby by Justin Etheredge.

Now, it’s not absolutely necessary to go through all of those steps to get started with IronRuby in Silverlight. Instead, just download the Silverlight Dynamic Languages SDK. Under the Releases tab, there are a handful of downloads. The one that you want is the one that has “Everything”. This includes the languages, samples, quick start templates and more.

Steps to get started:

1. Unzip the SDLSDK into a directory. I put mine in my public downloads directory for ease of access.

2. Open a command prompt, cd to the sdlsdk directory and run the script:

script\sl ruby demo

This will run the template to generate a starter Silverlight application with IronRuby as it’s language. You could substitute in python or jscript as well.

3. cd to the directory demo and run the script

..\script\server /b

This will run Chiron and then launch a new browser window pointing to the directory. Chiron will first package up the dynamic language files into the XAP and then host a simple web server.

4. Browse to the index.html file. You should see a simple page with “Welcome to Ruby and Silverlight!” displayed in the Silverlight instance.


5. Under demo/ruby, open the file app.xaml. Alter it as follows:

<UserControl x:Class=”System.Windows.Controls.UserControl”

  <Grid x:Name=”layout_root” Background=”White”>
    <TextBlock x:Name=”message” FontSize=”30″ />
    <Button x:Name=”button_main”
        Height=”30″ Width=”100″


6. open the file app.rb. Alter it as follows:

require “silverlight”

class App < SilverlightApplication

  def initialize
    message.text = “Welcome to Ruby and Silverlight!” do |sender, args|
  def button_main_click
      message.text = “Hello from the click handler”

$app =

The “do” in this case is wiring up a .NET delegate as the event handler for click event.

7. refresh the browser (or relaunch via Chiron per step 3 if you closed the browser).


There are a lot of other samples that are out there as well. Check out the ones under the sdlsdk/samples directory. Right now there’s a simple clock and a Flickr photoviewer that shows a lot of DOM and JavaScript integration.

You can also find samples at:

If you want to play with IronRuby or IronPython you can get started playing in the DLRConsole found at All the source for that is under the SDLSDK samples as well.

I’ll update the post once they put up the recording – .NET Coffee Break Show

Code To Live: Jay Wren on the Boo Programming Language

As many of you know, I’ve been playing with Dynamic languages with the DLR (Dynamic Language Runtime). It’s fun learning about new languages. Furthering that goal, I had the pleasure to sit down with Jay Wren about the Boo Programming Language and interview him for Code to Live. I intended to make it a 8-10 minute interview and cut him off so that I had very little editing to do. 46 minutes later, I cut off the camera. It was a fun interview with lots of code. I found out that the language is a dynamic language but it’s statically types. I thought that was an interesting twist on the language scenario. The syntax is based on C#, Python and even F# pulling a lot of the best practices from each of these languages. The most fascinating part of the language, however, is it’s extreme extensibility. The first example that Jay showed me was how to extend the language itself with With block style syntax ala VB.

I’m a better .NET programmer because of the things that I’ve learned about Ruby, Python and now Boo. I really understand the C# 3.0 features that are coming such extension methods. I understand how LINQ works better as a result of these languages. I’m thrilled!

I challenge each of you to investigate a new language. If nothing else, it will change your perceptions and improve your ability to write code in your primary language.

Check out the show and let me know if Boo is the next language for you to check out…

Code To Live: Jay Wren on the Boo Programming Language

Technorati Tags: ,,,

Contributing to the DLR and IronRuby

The Iron ManThis was a big enough bit that I thought that I needed a separate post from John Lam on IronRuby at the Portland .NET Users Group.

One of the things that John Lam addressed in his session was how submissions are going to work with the DLR and IronRuby. There are three separate bits, the libraries (this is most of the language), the core compiler (this is the interface between the libraries and the DLR) and the DLR itself.

IronRuby will take contributions to only the libraries until they get a whole lot closer release of the compiler and the DLR. Right now the DLR is such a moving target that it doesn’t make sense to have people contribute to the layers that run right on top of it as it’s likely going to change.

IronRuby will take contributions to the core compiler once 1.0 ships.

The DLR will be released with the MS-PL license, but it will likely not ever accept contributions. This was a bit of a shocking statement to me when he said that but then he explained it. It was a bit of a gloss-over though so I’m not sure that people caught this. The DLR will ship inside of the CLR which ships inside of Windows. Therefore, they can’t accept submissions to the DLR because they need to keep that IP pure.

When he said that a lot of things snapped into place for me. I’m not sure why I hadn’t thought of that myself. If they don’t keep the Windows IP pure, they are opening themselves up for potential lawsuits from someone who’s IP was injected into Windows without the proper licensing in place and so on.

FYI – you should check out It talks about Microsoft and it’s views on Open Source. It might surprise you.

Technorati tags: , , ,

John Lam on IronRuby at the Portland .NET Users Group

John Lam was at OSCON and stopped by the Portland .NET Users Group and did  session. Someone, probably Scott Hanselman, had a video camera and taped the whole session. Scott got the video and posted it on his site as a Silverlight streaming video. It’s pretty slick. There’s a lot of fun banter between Scott and John.

image I’ll warn you now – he’s not going to teach you IronRuby in this video. He assumes a lot of knowledge around dynamic languages in general and a little bit about Ruby in particular. Some of the bits that he gets into are deep in the framework. He talks quite a lot about how the method invocation and object creation bits work, performance and . It’s fascinating stuff.

Fun trivia that will make you popular at parties:

  • .NET’s GetType() on an object is 69 machine cycles.
  • MS-Permissive license has been submitted to OSI for approval. If they approve it, then we can officially say that we are doing open source. Otherwise we are just sharing code.

It was also fun to hear him talk about why he can’t go look at the source code for the Mats Ruby Interpreter. Since he can’t, he asks a lot of “silly questions” on mailing lists asking about inputs and outputs of particular APIs and the like.

Since they are working on the language still – they have been doing their best to get to a point where they can run the standard TestUnit, RSpec or even mini-spec. These testing frameworks use way too many features of the Ruby language so they can’t get it to run at the moment. John, created a simple mini-spec that does some really lightweight testing and specing. The goal, obviously, is to be able to run a full suite of tests against Ruby and IronRuby to be as close as possible on the original implementation.

Another bit that very good was that John said that getting Rails running on IronRuby is the only way that anyone will believe that it’s Ruby. It’s good that they are taking that very seriously.

John asks – “Would it be valuable to get Ruby running on ASP.NET?” – I’d love to hear the answer to that question myself. Feel free to leave comments or contact me directly

Scott’s original post on the topic is – Silverlight Video of John Lam on IronRuby at PADNUG 

Direct link to the video –

Technorati tags: , , , ,

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


eRubyCon Day 3 – Recap

eRubyCon wrapped up yesterday.

First talk of the morning – I heard Muness Alrubaie and Dan Manges, both from ThoughtWorks, talking about Ruby and Agile on a large project with ThoughtWorks. They have 30 people working on a single app – all at one war table in a conference room in Atlanta for 10 hours a day 4 days a week. They pair with the guy next to them. They shift pairs on every iteration. They move extremely quickly. It was interesting to hear them talking about the challenges of working an agile project with that many people. One of the small changes was that they had to formalize the format of their story cards, estimation and such. On smaller teams, they could be a touch looser because people all knew each other and each others styles. They standardized on the desktop setup, toolset that they are going to use, configuration of the tools such as colors in the editors and other things that are usually personalized per developer or at least on a pair level. The big thing that would have been fantastic to see would have been a ton more on the gotchas and pitfalls to watch out for. These are hard to verbalize but important. Some of these can be inferred from the things that they had to alter for the the larger group. They didn’t go into detail on issues that they had with integration which I’m sure that they had with that many pairs making extraordinarily aggressive changes a language that’s a compact as Ruby is. That has to lead to stomping on each other occasionally. It was a fantastic talk – I just always want more. One thing is for sure – they are proving that agile can work in large projects.

Josh HolmesThen I got to talk! This was a ton of fun. I’ll be honest, it was daunting to be speaking at eRubyCon and especially after so many fantastic speakers. My session was an introduction to Silverlight for Ruby programmers. My big demo was that I wrote a simple rails app that served up a Silverlight front end and then the Silverlight front end communicated back to the server via JSON. That was cool. I’ll be posting my slide deck here in a little bit. It’s not all my deck, I stole a lot of it from Scott Barnes and adapted it to work with my style and such. I did video the talk and plan on posting it at some point in the near future – but that’s going to take some work and time. I really wish that I had been able to show IronRuby off, but I don’t have any bits as they are supposed to drop next week. To quote John Lam, I had an “unfortunate timing issue” as the team is putting something out publicly next week.

After that I got to listen to Glenn Vanderburg with the closing keynote of the conference. He talked about a lot of the things that I’ve been talking (I need to blog a lot of this) about recently with IT as a cost center and how that’s dangerous. He had some great points about the implications of cost centers. In short, cost centers lead to wanting to cut down on the costs which leads to wanting to build things fast, cheaply and have them last for 30 years and are easy to update and change constantly to meet new requirements and regulations. He quoted Scott Bellware quite a bit and talked about the process of “Software Creationalism”. In short, Scott’s (and Glenn’s) contention is that the vast majority of tools and frameworks out today are all about the point of creation of software and don’t have nearly enough focus on the ongoing survivability and maintenance of the application. That results in “The creation of software is easy but the changing of software is hard”. I strongly agree that this is the current state of the discipline. Obviously, his conclusion is that what the enterprise needs is agile development. “To make it easier to change software, then built it by changing it”.

Another great quote – “If that’s not a one line change, then we need to refactor until it is.” – Glenn Vanderburg, eRubyCon 2007.

Software Creationalism – Scott Bellware [MVP]

erubycon – Columbus, Ohio 7/16-7/18

I’m speaking at eRubyCon next week (7/16-7/18) joining the other speakers such as Neil Ford, Justin Gehtland, Jim Weirich and Joe O’Brien among many others. It’s going to be an exciting conference. I’m speaking on Silverlight (keep scrolling down – it’s about halfway down). Here’s the Abstract:


Introduction to Silverlight

Silverlight is the latest in the continuum of technologies from Microsoft to help you create differentiated user experience in the supplemented web space. Based on XAML (eXtensible Application Markup Language) for its UI and backed by a number of different options for logic including C#, JavaScript, Visual Basic, IronPython or IronRuby (once it’s released) – it’s a exciting new tool in the back of tricks for any web developer. It brings with it a rich networking stack, fantastic media support, scalable vector graphics and much more on both Windows and the Mac in all of the major browsers including IE, FireFox, Safari and Opera. In this session, we will explore the boundaries of Silverlight, see the integration points and hosting options between Ruby and Silverlight and talk some about what’s coming with IronRuby.


I gotta say, it’s been a ton of fun putting together this session (not implying that I’m done). I’m playing with so many new technologies and ideas that I’m sure that I’m doing things exactly wrong but it’s fun and I’ve got a cool demo working. I wish that I had IronRuby bits, but the IronRuby bits are to be released at Oscon the following week according to John Lam

erubycon – Columbus, Ohio

MIX07 – Dynamic Languages

I’m sitting in the back of a Dynamic Languages session by John Lam and Jim Hugunin called “Just Glue it! Ruby and the DLR in Silverlight”. John Lam was a recent hire (January) to Microsoft. Prior to this he was working the Ruby CLR. Jim Hugunin is an architect on the CLR focused on DLR (Dynamic Language Runtime). He joined Microsoft specifically to work on Iron Python and make sure that the CLR was one of the best platform for dynamic languages such as Python.

They are showing a ton of very cool stuff. They are doing all of their programming in TextMate on a Mac. The samples so far have been in JavaScript, Ruby, Python and even Dynamic VB.

I recommend that you check out this session on the site when the recording gets up there. They do a fantastic job showing the power and ease of dev as well as poking a lot of fun at each other.

What’s a lot of fun is the interplay between all of the different languages. For example, they created a library in C# that they could pull in and leverage from Ruby and a JavaScript lib that was doing some 3D work that they pulled in and did some quick and easy work.

Link to Visit MIX07


Technorati tags: , , , ,

MIX07 – Silverlight to support Ruby and Python

I know that I already mentioned this – but I thought I’d call it out specifically as it was part of a much larger post.

Silverlight 1.1 Alpha supports Ruby and Python on the client side so people can write their RIA (Rich Internet Applications) in their own language. If you have not looked at dynamic languages – you should. There’s a lot of power there. Obviously, with power comes danger. I’ll be blogging more about Dynamic Languages later.

I ran into David Laribee who wrote about MIX07: Silverlight, IronRuby, and Dynamic Languages. He’s really geeked about Iron Ruby.


Technorati tags: , ,

MIX07 Keynote – Information Overload

BTW – long post! Too many announcements!

I’m just out of the MIX07 keynote featuring Ray Ozzie and Scott Guthrie (Yes I find it a lot of fun that the top guys at Microsoft on the technology side blog about what they are doing). I’m still trying to get my head around what I just heard. They have far exceeded my wildest expectations.

First – the client demos were sweet!

Neil Hunt of Netflix got on stage with some guys from Razorfish and demoed the great rich media and interactive video support in Silverlight. One of the cool things is that it was completely integrated into the back-end Netflix site for ratings, ordering and so on, has a chat app inside, collaborative movie watching where two people can watch the same movie from different parts of the world and it will keep them in sync and let them IM during the movie. That was cool and Netflix is a fantastic backer as they are very demanding on their systems and need the highest quality experience for their clients.

CBS got up and showed how they are integrating pro media with community contributed media tied to that pro media so that they can all of the sudden get content and points of view from an amazing number of sources instead of just their one camera guy.

Top Banana – I was already blown away when this section of the keynote came up. It’s one of the first managed applications with Silverlight and written with XAML and C# in Expression Studio, VS.NET and more. It’s a full blown video editor written in Silverlight. Wait – video editing in the browser? This is really blurring the line between desktop and web application. It’s only 50 kilobytes worth of payload to do all of the video editing. Yes – that’s 50k worth of code that’s downloaded. It does film stripping, frame by frame stepping, cutting, mixing, merging and everything that I could do with video. The did all of this in a month. are doing a ton with Silverlight as well. It has integrated overlays so you can watch the full screen video with overlays of your fantasy teams, pitch counts and more. It even ran on a phone! It’s a great experience and I’d love to talk more about it but I’m numb at this point with all the cool stuff.

Second – the Silverlight Beta (the cross-platform plug-in formerly known as WPF/e) is going to have much richer support for JavaScript and AJAX. That we expected and needed.

Third – there had been a lot of rumors and speculation about the next bit of business and that is that the Silverlight 1.1 Alpha is going to have the same exact CLR as the desktop version that allows you to leverage your existing .NET skills in VB.NET or C# to build RIA (Rich Internet Applications). Read that again slowly though. You will be able to write .NET to run in the browser on the client side of one of these RIA’s. In other words – you’ll be able to run .NET on a Mac in a Safari browser! That includes LINQ and the whole ball of wax! That just put Silverlight RIA’s in reach of any dev shops that are currently doing WPF with C# of VB.NET. And we are going to have support for Silverlight in VS.NET Orcas with a free download called the Silverlight Tools Alpha so we have proper tooling for the developers.

Fourth – The tooling is amazing. Expression Blend can export to XAML directly for Silverlight. That means that I’m not nearly as constricted by the limited number of controls and such that are available for Silverlight compared to WPF. It also manages and writes out all of your timelines, media integration, graphics work and so on. Expression Media does a great job of managing and encoding all of your videos. Expression Web has an AJAX Silverlight drop-in bit that can just drop in an RIA inside an existing application through drag and drop. As mentioned, VS.NET Orcas has support for development.

* Big point here * – Cross-Platform Debugging so you can do live debugging across the network to actually debug on the code that’s running on the Mac. You have access to the memory, objects, single stepping code and the whole nine yards! That’s amazing and it truly enables cross platform development!

* Another big point * – all of the tools from a SOAP perspective

Fifth – the Silverlight Streaming,  a companion service for Silverlight makes it easier for developers and designers to deliver and scale rich media as part of their Silverlight applications. Silverlight Streaming is a storage and video delivery service that will enable developers and designers to upload their application to Silverlight Streaming and then deliver this application to any website globally. Silverlight Streaming will provide 4GB of free storage as well as unlimited outbound streaming at 700 Kbps. For the first year, the service will be free. As the service moves out of beta it will be offered as part of the overall WL Platform offer, with continued 4GB free storage and free streaming up to 1 million minutes of streaming per site per month. Once a website goes over the 1 million minutes of streaming threshold, the site will have the option to take ads and revenue share or pay a small fee to help cover MSFT costs. Check out for more on this!

Fifth – and this one came out of the blue for me. The CLR will have full support for the DLR (Dynamic Language Runtime) including Iron Ruby, Iron Python and Managed JScript! Yes, you read that right – I had to ask for clarification when I heard about this too. You will be able to write your applications in C# or Vb.NET or Ruby or Python or Managed JScript! Sweet! That just put WPF and Silverlight (since it’s running the exact same CLR) in reach of any shop who knows XML so that they can write XAML and does programming. 🙂 I’m not saying that there won’t be a learning curve, but HOLY COW you can write Ruby to run in the browser on the client side of your application! For those of you who haven’t looked at Ruby and Python, you really need to take some time to delve into those languages and figure out some of the power and flexibility that dynamic languages bring to the table.

Sixth – Silverlight for Mobile!