Cocoa vs. Carbon

solrac

Mac Ninja
I know the basics.....
Cocoa is the native programming environment for OS X. Cocoa apps are totally and completely native. They take advantage of all of OS X's features. (Aqua, Protected memory, pre-emptive multitasking, symmetric multiprocessing, blah blah blah.

Carbon apps are OS 9 apps quickly rebuilt within "carbon". Which means they are basically old OS 9 apps yet they take advantage of aqua, protected memory, etc. etc.

So what is the real difference? If they both look and act exactly the same way, and take advantage of OS X's features, what is the difference between Cocoa and Carbon? Why is cocoa better? How can you tell what apps are true native cocoa apps?

For the answer, someone with in depth knowledge only please.

thanks,
-solrac-
 
Hopefully, someone who really knows whats going on here will chime in and correct my ambigularities.

Here's what I understand:

Cocoa is the most advanced. It is highly threaded, and generally runs faster. Its a form of YellowBox, the windows NT dev. packages made by apple computer.


Carbon is apple's mac os 9 tool kit ported to mac os x. So its got a few new fetures, such as better newtorking (no more open transport). But overall, may still lack the multi-threaded-ness of the cocoa apps.

On a slow system, like a beige g3, cocoa runs *much* faster than carbon. Like omni web runs more than twice as fast as opera or ie or moz/netscape.
On my G4, I can't tell the difference speed-wise ;-)

But I'm no expert in this stuff.
 
I don't think Carbon or Cocoa is faster. The difference is from a programmer's perspective, I believe.

Carbon is the traditional API like kilowatt said. It takes advantage of all of Mac OS X's new features, and it CAN take advantage of multi-threading.

Cocoa is a Mac OS X only, powerful yet easy programming toolkit derived from NextSTEP. It's object-oriented, so it's easier to program and debug, I believe. But Cocoa applications don't run any faster than Carbon applications, and they don't take advantage of any other features that Carbon programs can't.

One way to check if an application is carbon or not is to open the package contents of the application (if it isn't a package, it's almost always a carbon application, because packages are very convenient and it's pointless to not use them)... if inside the 'Contents' folder of the package there is a folder called 'MacOSClassic' and one called 'MacOS', then it is a Carbon application.

You can also quickly check by looking in the Get Info window. If it runs natively, but you can check the 'Run in Classic Environment' checkbox, then it's a Carbon application. If it only runs in the Classic environment, then it's a Classic application. If it doesn't have that checkbox, it's probably a Cocoa application, but not necessarily... (restarting in OS 9 and trying to run it will tell you.. if it doesn't run or just opens the package like a folder, it's cocoa... but if it runs but gives you a message that it can only run in OS X, it's carbon).

Hopefully someone can correct MY mistakes. ;)
 
Back
Top