Cocoa vs. Carbon

Discussion in 'Mac Apps and Mac App Store' started by hodgjy, May 5, 2005.

  1. hodgjy macrumors 6502

    Apr 15, 2005
    I know the basic differences between cocoa vs. carbon applications, but do cocoa applications run any faster or efficiently compared to carbon? I know about carbon not having as good of service support, such as speech.

    Also, currently MS Office 2004 is carbon, right? Is MS planning on making a cocoa version of office?
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    Cocoa is not a siver bullet. Cocoa apps are not magically better or faster than Carbon ones. That said Cocoa apps tend to be newer and written from the ground up for Mac OSX so often feel better that their Carbon equivilants on OSX.
  3. HiRez macrumors 603


    Jan 6, 2004
    Western US
    No. In fact, if anything Cocoa applications sometimes run very slightly slower than Carbon-based ones, since much of Cocoa still makes Carbon calls (thus adding an extra layer). Cocoa also has a slightly slower message dispatching structure itself, so even pure Cocoa is not faster, and Cocoa applications tend to create more objects in memory (many of them wrappers for Carbon structures). The advantage of Cocoa is in more rapid application development, and generally richer user interfaces. Originally Cocoa was supposed to replace Carbon, but now Carbon is such an integral part of OS X that both will be supported for quite some time.

    I doubt it anytime soon. There is little incentive for them to do so (and it'd be a massive undertaking as they'd likely have to rewrite the entire Office suite at the same time).
  4. darkwing macrumors 65816

    Jan 6, 2004
    I haven't really ever written a carbon app myself, but I've put in a little work on the OSX port of SNES9X, which is carbon. It seems to me that Carbon is just a c++ api, while cocoa is for Objective-C and uses the NextStep class hierarchy. Both have their advantages. I've written a few apps to teach myself Cocoa, and I like it and find it easy to use. It can be a little overwhelming when you aren't sure what class has what you need to overload to do something, though. It's extremely vast.

    The poster who said the advantages to Cocoa is more rapid development and richer interfaces was aboslutely correct, imho.
  5. hodgjy thread starter macrumors 6502

    Apr 15, 2005
    Thanks for the info. I thought carbon was ok, considering Finder is a carbon app, but I read something very peculiar last night in a book store when paging through a Mac book (don't remember the exact book, I apologize). The author made the claim that carbon is only around to port classic apps to OS X and that cocoa is better because it uses more the OS X toolboxes. So that got me thinking....
  6. bousozoku Moderator emeritus

    Jun 25, 2002
    Gone but not forgotten.
    Indeed there are advantages to building an application with Cocoa. However, if the application is intended for multiple systems, the framework of choice is Carbon.

    Carbon has progressed quite a lot since its early days and, considering that it's a set of C APIs, it's nicely advanced compared to what's available to Windows developers in the Windows 32-bit API. It is highly adaptable since it has no object-orientation.

    Cocoa has the advantage of a language which is highly developed and quite a long way ahead of languages such as C++ and ObjectPascal. Rapid prototyping and development are part of the framework. Many behaviours are already available and a developer can concentrate on the problem, as they say. As Objective-C is a more pure object-oriented language, it faces a speed deficit. Being loosely bound to external routines causes more of the same. However, the chance of creating close to error-free code is more likely than it is with Carbon and C or C++.

Share This Page