4

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.

apaderno
  • 28,547
  • 16
  • 75
  • 90
team-rf
  • 241
  • 1
  • 7

4 Answers4

3

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.

paulbailey
  • 5,328
  • 22
  • 35
  • MacRuby is a complete waste of time for someone looking to learn Cocoa programming. It is an amazingly well written bridge -- the best of the lot at the moment -- but it still like taking a French class and choosing to write all your papers in Spanish just because. – bbum Nov 24 '10 at 19:29
  • 2
    Yes, but as I read the question, this isn't a person asking how to learn Cocoa (or Obj-C), but rather someone who already has that experience and is wondering if he might be more productive in another language. – paulbailey Nov 25 '10 at 09:31
  • 1
    If you want to write Mac Software -- assuming Mac GUI software -- then using the bridges is a waste of time regardless of how much experience you have with Ruby or Python. The APIs, documentation and design patterns are all natively Objective-C. You'll have to know the language well enough to write code to understand how to build all but the simplest app anyway. Fighting with the impedance mismatch of a bridge just isn't worth it. – bbum Nov 28 '10 at 20:03
1

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.

bbum
  • 162,346
  • 23
  • 271
  • 359
  • I concur with the point of choosing a bridge in lieu of learning the language the frameworks are written in. Ditto on the Ruby object model similarity. – uchuugaka Jun 04 '15 at 09:41
0

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.

uchuugaka
  • 12,679
  • 6
  • 37
  • 55
0

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.

BarsMonster
  • 6,483
  • 2
  • 34
  • 47