views:

105

answers:

1

Hi, as a Mac outsider it seems that two popular programming languages on the Mac appear to be Objective C and Ruby.

From what I understand the main API Cocoa seems to be written in and optimized for Objective C, but it is also possible to use Ruby for that.

Are there different areas where each language is ideal, for example, I could imagine Objective C could be ideal for a GUI layer, or standalone desktop app, and Ruby could be good for web services etc. What about classic business logic, or data access layers?

What language would be a good choice for a library of services for example? Can we write a library in one language and link to it from a main program written in the other language?

If I wanted to write a layered enterprise application using domain driven design and dependency injection which languages could support each concerns? Are things like DDD and DI common amongst Mac devs?

Just a curious outsider.

+1  A: 

If I were to write a big application, I would stick to Objective-C only. It’s not hard, it’s the most supported option and for the foreseeable it will stay that way. As for Ruby, there used to be Java support in Cocoa that does not exist anymore. I’d hate to have a large legacy application written in mixture of Java and Objective-C and having the prospect of rewriting the Java parts or sticking with older OS.

(The previous paragraph applies to writing pure desktop applications. If you wanted and could write a part of the application say as a local webservice it would be quite different, as the Ruby support there would be much more dependable. Depends on your people, experience, goals and other variables.)

Dependency Injection and DDD are both abstract ideas, so yes, you can certainly do that in Cocoa. I have no idea about how many Mac devs do it. As for DI, there is strong support for loose coupling in Cocoa and the whole technology stack (see Interface Builder, KVO/KVC or bindings).

Hope that helps.

zoul
What does Java support, past or present, have to do with Ruby?
Peter Hosey
If you’re going to write an “enterprise application,” you should probably pick a technology that is going to stay for a while. The example of Java seems to leave Objective-C as the only really safe choice in this regard. (When speaking about desktop applications.)
zoul
@Peter Hosey, Zoul: What Zoul didn't mention very clearly is that Apple used to actively support a Java bridge to their Objective-C-based Cocoa frameworks. Since Mac OS X 10.4 this is marked as deprecated and any new features added to the frameworks are no longer made available in the Java bridge. The risk with using Ruby is that Apple may similarly "close" the bridge at some time in the future. Although with the development of MacRuby to replace RubyCocoa, that now seems less likely to happen. See the "Cocoa (API)" article on Wikipedia for more details.
Rinzwind