Ever since I first started programming, I've been fascinated with all of those other languages that I hadn't learned. Many of them I loved, like Python and Java; many I subsequently took up regularly, like Objective-C and Processing; a few I just never could get used to. I'm thinking in particular about Ruby. Some people love Ruby, and most of them will constantly sing its praises, but me? I could just never get into it. Maybe it's the ultra-simplified syntax or the lack of terminating symbols, but Ruby and I just never clicked.
When I got MacRuby: The Definitive Guide by Matt Aimonetti I thought there was some chance things had changed between me and Ruby, especially via MacRuby, Apple's implementation of Ruby. It runs natively in the Objective-C runtime, but provides programmers with an alternative to Objective-C, a language that is extremely verbose, and somewhat notoriously difficult to learn.
Mr. Aimonetti's book is well written, and he even begins the instructional part of the book by saying that rather than making the reader "wade through MacRuby's history, the technical aspects of the implementations, and their pros and cons" he will begin by having us start coding. I think this is a great approach, since information on these topics is hard difficult to come by. This way, I can get right down to it. The book then had me write a tiny program to create a very OS X-like take on the traditional "Hello World" program, followed by an explanation of what you've just done. Here I feel Mr. Aimonetti commits a slight faux pas: he doesn't explain exactly where I need to enter the code he presents until after the code snippet, which is not just a line or two, but actually rather long. This happens right after he discusses the installation of MacRuby, and my assumption was that I should add the code to a new MacRuby XCode project; instead, I was supposed to save it in a HelloWorld.rb file. Still, this is pretty minor and is probably just a stylistic decision.
The rest of the book took me through first some Ruby fundamentals, followed by XCode-specific bits like connecting user input, followed by some Cocoa-specific framework discussion. Mr. Aimonetti goes step by step through every aspect of MacRuby programming, finishing with some practical examples, and some discussion of how to include MacRuby code in Objective-C projects, and vice-versa. It's interesting, as an Objective-C programmer, to go through what seems to me almost like alternate universe ways of doing all of things that I typically do using plain old Objective-C. I would suggest to anyone considering this book who isn't already familiar with Objective-C that they also investigate O'Reilly's excellent Programming iOS5 by Matt Neuburg, a book that parallels this one rather well. As a matter of fact, I'd suggest that a prospective reader make sure that know at least a tiny amount of information about Objective-C, Cocoa, and XCode to start with.
So did this book convert me? Having read it, do I love Ruby, like so many of my colleagues? Nah, not really. Personally, I still have the same issues with Ruby that I always did. But that's not due to any shortcoming of Matt Aimonetti's book. I found it to be an interesting read, and that it was well written and organized. It's also extremely comprehensive, covering just about everything there is to know about MacRuby.