“The” IronRuby Tutorial

23 Jun 2009

Hidden in yesterday’s commit to IronRuby’s GitHub repository is evidence of some polishing changes to the IronRuby tutorial app, which I’d like to introduce to you peoples:

ironruby-tutorial

To run yourself:

  1. Get IronRuby from GitHub and build it (in release mode preferably)
  2. cd Merlin/Main/Languages/Ruby/Samples/Tutorial
  3. ir.exe wpf_tutorial.rb

Isn’t he/she/it a bute!? This app makes Ruby-based tutorials interactive, guiding you through the material with a IronRuby REPL console and other visual aids such as another window, or whatever the tutorial writer sees fit. There is also a tutorial runner for the command-line, and a exporter for static HTML.

The IronRuby tutorial included covers topics such as using the interactive window, built-in libraries, exploring .NET libraries, generics, events, Windows Forms, and Windows Presentation Foundation.

While the tutorial is currently no where near a complete guide to IronRuby, it’s a great place to get started. Also, the first two chapters of the TryRuby tutorial is included as well for testing reasons, but may or may not be ever finished … unless someone wants to make it work, more on how to do that later.

But it can teach all by itself!

While the content of the tutorials can be awesome, and this app can teach the material very efficiently, it can never teach the real experience of building an app in IronRuby. So the IronRuby tutorial app is written in IronRuby as an example of doing all the things a tutorial can’t. Wow, very meta.

Currently, the tutorial app itself covers:

  • User Interfaces in Windows Presentation Foundation
  • Ruby as Data: the tutorial domain-specific language
  • Testing a Ruby application with test-spec
  • Developing a GUI application interactively
  • Anything else we can cram into it in the future :)

These area will be covered in a series of future posts, so keep an eye out for them!

Still plenty of work to be done

This app is far from done, so the exploration of IronRuby in WPF has just begun. Here are some known issues, so don’t complain about these =P

  • The REPL doesn’t have any history via up/down arrow keys.
  • The “Jump to another section” menu scrolls too much. This list can only be two items deep, so it's needs to change to arbitrary depth to have more nesting.
  • The content isn’t totally complete, though the IronRuby tutorial is in great shape. If you have suggestions on topics, please let me know.
  • Jumping between tutorials a bunch makes the memory usage increase to Rails-like proportions (160MB). Not sure why yet. :(
  • The code isn’t the best, but it works. =P I’ll be reorganizing it in future posts about client development, but it serves its purpose for now.

Of course there are a ton of other things that could be done. See the TODO file for some ideas.

Please try it out and let me know what you like about it, what you don’t like, and feel free to futz around with the code as well … contributions are welcome. Enjoy!

Technorati Tags: ,,
comments powered by Disqus