Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Talking with Ivan Porto Carrero about IronNails

Talking with Ivan Porto Carrero about IronNails

This item in japanese

A new project has been created for developers using IronRuby to write applications with a Ruby on Rails like experience.  The project is called IronNails and is ready for developers to give it a go today.

IronNails is developed by Ivan Porto Carrero, developer, writer and Ruby fan.  Ivan has opened the source for other developers to use and develop further.  He describes IronNails as a "Rails like development for IronRuby and WPF/Silverlight".  InfoQ had the chance to catch up with Ivan and talk to him a bit about IronNails.

We asked Ivan to describe what IronNails is to him:

IronNails should become an IronRuby specific gem that brings the Rails style of development to WPF and Silverlight. That means it should have generators, similar scripts to start the console, a plug-in framework and so on.  At the same time I would like it to be able to take advantage of the existing tools like Blend or Illustrator for doing the layout. Blend is a tool specifically designed for designers to design GUI's and add interactivity to them. That being said it should also be possible to just use arbitrary XAML files or maybe even a XAML DSL for creating views.

The vision is that by predefining a bunch of behaviors designers can drag and drop that behavior in tools like Blend. A behavior can be left click, right click, hover (enter/leave), ...  The developer that continues the work can then link that behavior to a named command which links to a controller action.  This can all be achieved in WPF with attached properties (dependency objects) it will just be a lot of work :).

The project is very interesting and is written to be used with IronRuby, which is yet to be released, we wanted to know why the framework was created in the first place:

Currently I'm working on the book IronRuby in Action for Manning and this came up while I was exploring possible ways to use IronRuby and WPF together and it seemed like a great idea to me.

I experimented a little with interface builder and ruby cocoa on the mac and liked the flow the project Rucola presented. Rucola aims to do the same thing as IronNails but for cocoa. The way cocoa thinks about views is different from Microsoft that's why the concepts that are being used in IronNails are also different. But if Eloy reads this, he's the one that showed me the path.  One of the things it should do is allow you to develop efficiently with e-editor/Textmate or any editor of your liking. It should get good integration with Test::Unit and RSpec and aim to solve the same problems that the Rails framework solves for web development. 

I like the MVC pattern for doing web development and I've found it to be a good fit for most of my projects, so I wanted to create a way to do this for WPF and Silverlight development.

Any new tool or framework is often defined by the creator and the community may see the tool as something different entirely, so when asked to define IronNails intended usage:

However you see fit :) But I guess it should enable you to use the best tool for the job at hand if it's design and layout IMHO you're better off doing that in a tool that is specifically designed to work with visual elements. If the job at hand is coding then an editor would be sufficient for some people or a more heavyweight IDE. In the end you should be able to do IronNails < >, which will give you an application skeleton. After that you can generate controllers, models and even views with a command-line generate command. A newly generated view will be added to the csproj file for the design tool so that designers can start adding content to it.  As I've mentioned, the designer can define behaviors on any element, which the developer can redirect to a named action. And the designers can generate the story boards etc. with their tool of choice.

The framework has some predefined folders in which it will look for skins. A skin contains the templates for the application. The views contain databound controls and the general layout but the idea is that you separate contents into the templates and out to skins files (resource dictionaries). That way you get a nice separation between content and layout and you can easily create new skins or visualize data differently.

IronNails is a tool which gives additional functionality to IronRuby and WPF/Silverlight, regarding the type of value add:

It implements the Model - ViewModel - View - Controller pattern that seems to be popular in WPF. It is built on some of the concepts that are seen as best practices for decoupling your code from the XAML. In virtually all cases you shouldn't need to do anything in the code behind because the ViewModel takes care of providing the commands and linking between the view and the controller.

It does all this by providing a familiar experience to Rails developers. It uses metaprogramming to generate the view model and allow you to bind to the objects you define in your controller. You can define a view model yourself to add customized behavior but you don't need to. There are some naming conventions to be followed but it should just work after that.  It enables a very testable way of development and has tight integration with popular Ruby testing frameworks.

Microsoft has said IronRuby will be released in the first quarter of 2009 and with so much more work needing to be completed, IronNails has to wait before it can be completed.  Ivan's thoughts on the future IronNails:

At this moment I cannot take IronNails as far as I want to take it because of missing features in IronRuby. As more features get implemented in IronRuby we can move more and more stuff away from C# into a Ruby code base. At the moment it's not possible to bind to a pure DLR object in XAML but in the future that will be possible. Currently there are some hacks and workarounds in the code base but they will also be replaced as support for those things is added to IronRuby.

As said earlier I wrote it for my book on IronRuby but it seemed to good to let go, so if there is some interest from the community this project can continue to evolve and keep up with the language and frameworks.

Being an open-source project, there is always room for outside developers to lend a hand and Ivan has said he is ready for help:

IronNails is hosted on GitHub.  They could get involved by just submitting patches through the GitHub system of forking and pushing. Or they can email me with their GitHub username and I can add them to the project. There is also a Lighthouse project for it where people can submit tickets. I accept all kinds of help like code, documentation, tests, ...

I expect that I can't be actively involved to code more in the project until I've finished my book. I may be able to spend only a couple of hours per month on it which isn't a lot so I'm counting a little bit on the community to keep it alive until I can dedicate more time to the project too.

More information about IronNails can be found on Ivan's blog and can also be downloaded from GitHub.

Rate this Article