Difference Between Cocoa & Carbon 6

Discussion in 'Mac Programming' started by dieseltwitch, Jan 6, 2009.

  1. dieseltwitch macrumors regular

    Jan 24, 2008
    As the title implies I'm just looking for the difference between the the two?
  2. caveman_uk Guest


    Feb 17, 2003
    Hitchin, Herts, UK
    One's a C API and the other is an Objective-C API.
  3. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    To expand slightly on caveman_uk's description:
    Cocoa is an Objective-C API that is Apple's currently preferred method for writing applications for OS X. It allows the use of Interface Builder to build GUIs. It gets the "latest and greatest" updates from Apple as new OS updates are released.

    Carbon is a C API that Apple still supports for writing applications on OS X, but it's original intent was to provide a bridge from the "Classic" (pre-OS X) Mac OS to OS X. While it has not been deprecated at this time, and it may not be soon, it is no longer being updated with the vigor that Cocoa is, and it will not, for example, be given full 64-bit support.

    There are still a number of "big league" applications written in Carbon (a number of Adobe applications, for example), but it is recommended that if one were to be starting a new project targeting OS X, that Cocoa be used. There are arguments that using Carbon is easier when writing the Mac OS version of a cross-platform application, but I am not familiar with these.

  4. Sayer macrumors 6502a


    Jan 4, 2002
    Austin, TX
    Actually Cocoa is an application framework, not just an API.

    The difference is that a lot of functionality is packaged into a framework and your code simply adds to or modifies existing framework behaviors. Managing documents, multiple windows, saving/reading preferences are some of the more mundane tasks that the frameworks handles for you, many times completely automatically in your app.

    With Carbon you have to write a lot of the application functionality (not nearly as much as you used to do with Classic Mac OS).

    A lot of what is now "Cocoa" is actually built on top of Carbon APIs, but wrapped up with lots of bells and whistle features and with the complexity almost completely hidden away from the programmer.

Share This Page