Should I learn MacRuby or RubyCocoa [closed]
Asked Answered
E

3

16

I am wanting to learn mac development with ruby but I'm not sure which one to go at. RubyCocoa has been around longer but I think MacRuby will beat it out in the long run..

Any suggestions??

Epaulet answered 29/3, 2009 at 20:21 Comment(0)
T
37

Go with MacRuby. It's the future :)

It's newer, way faster, and much better integrated. HotCocoa is awesome as well.

MacRuby is a Ruby VM implemented on top of Apple Technologies as opposed to a bridge like RubyCocoa. A Ruby String for example is an NSString by nature, instead of being bridged by the runtime. It's a much cleaner, faster and more solid approach. It's also developed and sponsored by Apple, which means it could become part of OS X at some point.

Also see this post: Why MacRuby Matters

Tehee answered 29/3, 2009 at 20:31 Comment(2)
By the way, I believe a MacRuby string is actually a CFString which is toll-free bridged with NSString.Placet
Plus, you can create a new MacRuby project right from XCode. MacRuby support is built in!Rigatoni
A
8

Since Chuck replied to you, things changed quite a lot, MacRuby now uses LLVM, allows for AOT compilation and is quite stable and much faster than it used to be. The ruby side of things still need some work for be 100% compatible but as I'm writing this response, 0.5 is still in beta and you should see ruby libraries being compatible very quickly.

Addend answered 10/10, 2009 at 20:20 Comment(0)
M
7

RubyCocoa is more mature and better tested. MacRuby is simpler and better designed overall. MacRuby is also about as stable as a lawn chair sitting on a beachball. Seriously. It's definitely the one you want to use in the long run, but it isn't there yet. They're not so different that you'd have to "learn" one versus the other. They're both just Ruby with access to the Cocoa APIs. It's more about knowing the Cocoa APIs than anything else.

I would recommend learning Cocoa with Objective-C. Once you have a good grasp on the central concepts of the framework (which are all based on Objective-C), then you can use Ruby if you still want to.

Update 2011

The above is no longer true of MacRuby. It's very solid and fast enough to do most kinds of Cocoa applications in pure Ruby. The MacRuby team have also gone out of their way to be compatible with pretty much all of the system frameworks, even the C ones. If you like Ruby and want to do Mac development, it's definitely something to consider. There is no reason to choose RubyCocoa anymore unless you need to support ancient versions of OS X or PowerPC (MacRuby is strictly Intel 10.5+). The remaining caveats:

  • Having to include MacRuby.framework in your apps puts a high lower boundary on bundle size (a couple dozen MB for "Hello World" IIRC)

  • Although it's stable in general, it's still very new beta software, so there are a few wrinkles in the less-used corners of the libraries (e.g. Pointers have a few quirks), and some design decisions aren't final (e.g. concurrency support is evolving rapidly)

  • The documentation is still a work in progress, and lags behind the fast-moving language. A lot of articles you'll find about MacRuby suggest that HotCocoa is the cool, native way to make apps — it is a cool experiment, but it is now abandonware with some critical flaws that make it unsuitable for large-scale application development. The standard Xcode toolchain is the supported way to do MacRuby development.

I also still recommend learning Cocoa with Objective-C, just because that's the framework's native language and thus the path of least resistance.

Mean answered 29/3, 2009 at 20:50 Comment(3)
If you have recent experience with MacRuby it would be nice to update this answer (or add a comment) on the current state of stability.Albric
@Phrogz: Thanks for the nudge. Updated.Mean
Great information, thanks! (I was just about to start down this path and had been eyeing HotCocoa closely.)Albric

© 2022 - 2024 — McMap. All rights reserved.