View Full Version : What's the difference between Cocoa and Carbon?
I know, dumb question. I know a lot about macs, on the outside. I know a lot about how to fix things, do this, do that within the operating system or any given application. What I don't know anything about is programing or coding.
All I know is that Cocoa and Carbon are different programing things for OS X but that's about it (not to mention I could be wrong). What I'd like to know is what are the differences, why are there two, are there more, and which one is better under different circumstances.
Thanks,
[nate]
Cocoa applications are specifically created for OS X, carbon were written for an earlier system and updated for OS X.
So I assume that all apps made by apple are cocoa? Okay, I see. But wouldn't it be worth the effort to rewrite in cocoa for things to run more smoothly? Like, is M$ office in carbon?
Carbon: Derived from the old Mac that we knew and loved. The old programming libraries dating back to 1984 were cleaned up, modernized a bit, and a bunch of old legacy stuff was tossed out. Carbon is C, with some Pascal items thrown in, and is strictly procedural.
Cocoa: Derived from the frameworks developed on the NeXT system. Uses Objective-C as the language, and is object-oriented from stem to stern.
Me, I'm a Cocoa head, hands down.
Carbon is a bridge technology, to allow seasoned Mac developers a way to move their code to MacOS X with the least pain... but Cocoa is the advised route for new, from-scratch, application development.
Cocoa applications are specifically created for OS X, carbon were written for an earlier system and updated for OS X.
This is incorrect.
Cocoa applications can be specifically created for OS X, although they could also have been written for NeXT Step and updated for OS X, or written for GNUstep and ported to OS X.
Carbon applications can be specifically created for OS X, although quite often, they were written for Mac OS 9 or earlier instead and updated to work on OS X.
Cocoa applications are definitely Mach-O; Carbon applications can be, but they can also be CFM, especially when they were previously (or are still) available for OS 9, which doesn't support Mach-O.
...carbon were written for an earlier system and updated for OS X.
Not true at all.
Many Carbon apps were written first and only for Mac OS X.
edit: Beaten by mere seconds! You'll rue the day, chucker.
Google is Not your friend.
Yes, it is. You just have to be able to differentiate between reliable and unreliable sources. :)
So I assume that all apps made by apple are cocoa?
For newly-written ones, this is almost always the case. Also, quite a few were first written in Carbon and then rewritten for Cocoa; iMovie (2 -> 3) and DVD Studio Pro (1.5 -> 2) come to mind.
But wouldn't it be worth the effort to rewrite in cocoa for things to run more smoothly? Like, is M$ office in carbon?
MS Office is indeed written in Carbon. In theory, a Cocoa application should be slower, not faster, than a Carbon application. This is because Cocoa applications are designed to take more advantage of high-level frameworks in order to enable many features that otherwise would be designed by hand from the developer. For example, a Cocoa application, if it uses Cocoa's NSTextField, automatically has access to features such as spell checking. A Carbon application cannot (easily) have this, so the developer is more likely to design this on their own, which means on the downside that they will have to keep it up-to-date themselves, but on the other hand, it also means the implementation will be optimized to their very specific needs.
In practice, things look a lot differently. In the cases where Carbon applications were ported to Cocoa, there was usually quite a performance gain -- not primarily because of inherent advantages of Cocoa, but because the mere fact that the app had been rewritten from scratch forced a redesign, which inevitably means optimizations.
Which still doesn't answer your question. Would MS Office be faster in Cocoa? Probably. Would Microsoft want to do this? No, for two reasons: 1) the code would be limited to Mac OS X. Sharing code between their Mac Office and Windows Office would become more difficult and require bridges or frameworks designed in a platform-agnostic manner. 2) A lot of time, money, people -- i.e. resources -- would have to be invested into making this happen. It would be a huge project, and whether the result would actually be significantly noticeable is questionable. Would the users gain from this? Absolutely. Would the users care to pay the Microsoft MacBU to invest into this? I doubt it.
university of michigan bastards! (http://art-design.umich.edu/it/answers/carbon.html)
A good example of seeing this "have entirely 'native' interfaces but share code in the back-end" idea work is Skype. The Skype UI on Windows and Linux is written in Qt, so they get to share the code there. On Mac OS X, however, they have decided to write it entirely in Cocoa, making use of OS X-specific ideas such as drawers and the Growl framework. Yet, thanks to a shared, common library in the back-end, they still don't need to reinvent the wheel.
university of michigan bastards! (http://art-design.umich.edu/it/answers/carbon.html)
Yeah, that's inaccurate.
Carbon applications are applications that were originally designed for an earlier Mac OS, but have been adapted and updated to run in OS X
Often, but not necessarily.
--these programs have the distinctive OS X look,
To a degree, but not necessarily entirely. Look at AppleWorks for a good counter-example; it doesn't look and feel OS X-native, aside from basic widgets such as the menu bar.
In contrast to Classic, of course, this is true.
university of michigan bastards! (http://art-design.umich.edu/it/answers/carbon.html)
You are taking the word of the Art Department IT folks? On a computer science level question?
Actually the IT part of the header would have been enough for me, auto loss of credibility. Apologies to the artists, they just need to learn who to associate with.
Since this is a matter of two major programming APIs, I'm moving this off to the Programmers Nook.
thuh Freak
2005-12-06, 23:00
Cocoa tastes better. More chocolatey.
True, but charred flesh done over an open fire has it's primal attractions. Mmmmm, just a little bit o'carbon!
vBulletin® v3.6.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.