PyObjC / Ruby bridge. Is it worthwhile ?

472 Views Asked by At

Years ago wanting to write Mac software and having loads of experience with Java WebObjects I tried the java bridge but decided to bite the bullet and learn Objective-C (fortunately since I would have hated having my software deprecated with the bridge). Later I fooled around with RubyCocoa. I learnt Ruby (found it interesting indeed), but found out the hard way that the bridge was far from mature or stable and at the end I ended porting the code back to Objective-C.

Since years have passed, I'm wondering if it is worthwhile investing some time with MacRuby, or even learning Python to use PyObjC. As much as I like Objective-C, I recall being way more productive with the Ruby bridge when it didn't crash. I just would hate investing time to end up with crashy software again.

4

There are 4 best solutions below

3
On BEST ANSWER

I would say MacRuby is the way to go if you want to try one of the bridges. It's being developed by Laurent Sansonetti, who's a Senior Software Engineer at Apple working on Ruby.

It's quite functional now, and integrates nicely with the native frameworks. Worth a look, particularly if you already have Ruby experience.

1
On

If you want to learn Cocoa programming, ignore the bridges. They will only make writing Cocoa applications more difficult and you will waste a bunch of time getting up to speed.

Specifically, you will need to learn Objective-C to be able to understand both the APIs and design patterns of the system frameworks. Furthermore, all of the documentation and tools are written specifically to support Objective-C.

The bulk of your time in learning Cocoa programming will be spent on said APIs and design patterns; the actual language part is relatively small, by comparison.

Note also that the bridges necessarily incur an impedance mismatch in an attempt to map not-quite-the-same functionality from one language to another.

Frankly, if you know Ruby, then Objective-C should be trivially easy; the object models are very similar.

0
On

My personal opinion is use ObjC for Mac native apps.

Use Ruby/Python where they supposed to work good natively without unreliable interfaces with questionable support.

0
On

Here is why it is NOT a waste of time. In some cases, Ruby and Python have awesome and well developed libraries that are not available in Objective-C and would not likely be. That is one of the best use cases.

Example: you wouldn't want to reimplement Rails in Objective-C, (some people might) but you could easily use it, parts of it to power a Cocoa app with MacRuby.

Well MacRuby is dead. There is the commercial RubyMotion.

There is still PyObjc, RubyCocoa and mruby.

One of the other intriguing use-cases is to provide script ability that doesn't stink like AppleScript and OSA.

There are valid reasons.