Half-a-Book Review: IronRuby in Action
Earlier this year, Ivan Porto Carrero did a quite enjoyable presentation on IronRuby for the Dutch ALT.NET user group. I recently picked up the early access edition of his book IronRuby in Action, which was a quite challenging read for me.
I must admit, I’m a complete noob when it comes to the Ruby programming language. I’ve been very interested in everything it has to offer, but I never learned or used it so far. I’m vastly determined to do something about this, and that’s why I read this book.
At the moment of this writing, only five chapters of the book are available. The first chapter provides an overall view of dynamic languages, explaining the differences, advantages and disadvantages of static languages versus dynamic languages. This opening chapter also provides a step-by-step guide of how to get IronRuby up-and-running on your machine as well as an explanation of the importance of unit testing for code written in a dynamic language. This is something that can’t be emphasized enough during talks or discussions about dynamic languages, but which is nicely covered by the author.
The second chapter provides a crash course of the Ruby programming language, where the major aspects of the language itself are briefly touched and explained. Although the author tried very hard to explain as much as possible in this single chapter, I felt that I needed to pick up another introductory text on Ruby and that trying things out on a slower pace would be more beneficial for me (remember, I’m a Ruby noob).
The third chapter provides a nice overview of how to host the Dynamic Language Runtime in your own applications. This chapter also provides a quick overview of how the hot technologies du jour (WPF, Silverlight and ASP.NET MVC) can be used with IronRuby. The author even got me interested in WPF for a moment there (don’t worry, its over now 😉 ). Take a look at the following WPF code using meta-programming in IronRuby:
# build the window obj = Wpf.build Window, :title => title, :height => 500, :width => 826, :name => "Biffy" do add DockPanel, :name => "dock_panel" do add TextBlock, :text => title, :font_size => 36, :background => :alice_blue, :dock => :top, :name => "text_block" add StackPanel, :orientation => :horizontal, :dock => :top, :name => "stack_panel" do add TextBox, :text => start_url, :width => 750, :name => "web_url" add Button, :content => "Show site", :name => "get_url_button" end add Frame, :source => start_url, :name => 'web_page_display' end end
Look ma, no XAML! Looks good, doesn’t it?
Chapter 4 provides a detailed step-by-step implementation of a Twitter client that is built using WPF. Chapter 10 talks about using the Rails framework with IronRuby. First a detailed explanation is given on how to install Rails on your machine, after which another step-by-step implementation is provided for a server side Twitter application.
After I finished reading these chapters, I realized that I need to pick up some more introductory material on Ruby, like the Pickaxe book or the Why’s (Poignant) Guide to Ruby. But one thing’s for sure, the author has a lot of experience with Ruby and that is reflected throughout this book. I’m already looking forward to read the other upcoming chapters.