Posted by Vinícius Teles over 5 years ago.
In the Mac it's possible to create graphical user interfaces using Cocoa easily with Interface Builder. So one can drag components around, setup actions and establish connections with the code which is implemented in Objective-C.
Objective-C is an object-oriented programming language which adds Smalltalk-style messaging to the C programming language. It's a very interesting programming language, although a very verbose one. For those who want to create desktop applications on a Mac, or iPhone apps, it can represent a significant barrier. The language is arguably harder to use when compared to others like Ruby.
Ruby is a programming language created with the purpose of making programmers' life easier. It's simple, elegant, easy to use and very expressive. It's also adored by those who use it including myself. :-)
So, on the one hand there is this incredible technology for building graphical user interfaces, called Cocoa, and on the other hand, there is this amazing language called Ruby. Wouldn't it be great if we could use them together? Well, it turns out that this has been possible for a while using, for instance, RubyCocoa which bridges Ruby and Objective-C. But nowadays there's a better option called MacRuby.
From MacRuby's website: "MacRuby is a version of Ruby 1.9, ported to run directly on top of Mac OS X core technologies such as the Objective-C common runtime and garbage collector, and the CoreFoundation framework. While still a work in progress, it is the goal of MacRuby to enable the creation of full-fledged Mac OS X applications which do not sacrifice performance in order to enjoy the benefits of using Ruby."
In the last few days I implemented a feature using MacRuby and Cocoa. It's something useful to us, although pretty basic. It helps us to setup new domains in the DNS of our Slicehost account, where we host our applications. I'll make the code available at GitHub soon.
I found it easy to implement this feature using Cocoa and MacRuby. It showed me that the purpose of the MacRuby project has been achieved at least in this specific case. That is, it really made it much simpler to implement this feature, compared to the Objective-C version of it.
So I'm very enthusiastic about all that can be done with MacRuby. I'm particularly thrilled with the ease of use and increased speed of development. So I'd recommend everybody to take a closer look and learn it.
I'd like to thank Matt Aimonetti who kindly introduced me to MacRuby when he was in Rio recently.
If you're not excited about this project yet I offer you a few more informations. MacRuby is sponsored by Apple itself who seems to have a great deal of interest on it. As a matter of fact, the project creator, Laurent Sansonetti works for Apple and spends most of his time on MacRuby. Why?
Among other reasons, it's probably because in the near future, we might be able to develop iPhone apps using MacRuby! And that opens the gate for many Ruby programmers who will be able to create iPhone apps using their favorite programming language. So, if you're not yet programming in Ruby, maybe this is the excuse you've been looking for. ;-)