views:

311

answers:

3

What is the difference between carbon and cocoa ? For what type of applications we should use carbon and for what type of applications we should use cocoa ? Which is the best of both for developing applications in Mac OS ?

+2  A: 

Carbon is deprecated (it does not and will not exist in 64-bit).

For new application development, use Cocoa (I'm talking about native OS X application development the Apple-sactioned way. Obviously other alternative choices exist, such as Java, Python, Ruby, etc, which may be effective depending on your project type if a native UI is not required)

Wade Williams
Cocoa and Carbon are APIs, not languages. Java, Python, and Ruby are not "alternatives" to Cocoa. While there are some serious caveats, you can access both Carbon and Cocoa from all three of those languages.
dmazzoni
Never said Cocoa and Carbon were languages. Additionally, Java, Python and Ruby are certainly alternatives to Cocoa-application development if your project does not require a native UI. My point was, there are other options *depending on his project type.*
Wade Williams
@Wade You're still conflating APIs with languages. While Cocoa is indeed best used with Objective-C, Java, Python, and Ruby all have access to it as well. They are not "alternatives" to Cocoa.
phoebus
Huh? Cocoa _is_ an Objective-C API, not a Java, Python or Ruby one. It's written in Objective-C and used with Objective-C. It can be used from other languages though bridging, but that's more a bridge between those languages and Objective-C than a bridge specific to Cocoa. All those languages use Cocoa _through_ Objective-C, they are not equivalent to Objective-C regarding the Cocoa APIs.
Adrian
Wade Williams
+3  A: 

Carbon was created to ease the movement to and from Mac OS 8 and 9. If your code needs to run under OS 8 or 9, then Carbon is the way to go. (Source)

However, if your software is designed for OS X, then you should emphasize Cocoa over Carbon.

Chip Uni
+9  A: 

Short answer: For a new application, use Cocoa. Some legacy code may still use Carbon and if you don't need any new capabilities, it will continue to work.

Cocoa has an Objective-C API, and can be accessed from C and C++ code easily. Carbon is a pure-C API. There are both Cocoa and Carbon bindings for many other popular languages, but there are often some limitations.

Carbon is evolved from the original API for the original Apple Macintosh (and Apple Lisa) in the early 1980s. Specifically, when Mac OS X was released, Apple was unable to support some of the legacy Mac OS API functions, but provided a subset of legacy APIs called "Carbon", to ease the transition for developers who had pre-Mac OS X applications. They added thousands of new APIs and continued to fully support Carbon for several years, before finally deprecating it more recently. They have always said that Carbon is a dead-end and all developers should move to Cocoa.

Cocoa has evolved from the NextStep framework that Apple acquired and used as the basis to create Mac OS X. It's the "native" API for Mac OS X and the only way to access some of the newest capabilities.

dmazzoni