(This weekly column looks at features and products that revolve around Mac OS X, Apple's next generation operating system that's due in early 2001. If you aren't familiar with terms like "Rhapsody" and "OpenStep," check out our explanatory "Note" at the end of this article before proceeding.)
This week at the request of several readers, we're going to look at the differences of Carbon and Cocoa. Both are programming/developing environments. End users won't, as a rule, be able to differentiate between applications developed in the environments, but Carbon and Cocoa are definitely two different critters.
The Carbon environment runs all Mac OS 8 and OS 9 applications whose code has been optimized for Mac OS X. When you read of an application that's been "Carbonized," its code has been "tweaked" to take advantage of some of the features of the next generation operating system. The Carbon environment features a set of programming interfaces derived from earlier versions of the Mac OS.
By converting their code to use the new Carbon application programming interfaces (APIs), developers ensure that their products take advantage of such OS X goodies as protected memory, preemptive multitasking, and other features of Mac OS X. The Carbon APIs have been modified to work with the foundation of the operating system, the kernel environment.
Carbon carries forward most of the existing Mac OS managers and APIs. According to Apple, this entails about 70 percent of the total functions and 95 percent of the functions used by typical applications. Or to put it another way, Carbon keeps about 70 percent of the total functions and 95 percent of the functions used by typical applications. Carbon also includes additional APIs and services specifically developed for Mac OS X.
While Carbon is the means by which most Mac developers will get their apps up to speed for Mac OS X, Apple recommends Cocoa for developers with new ideas who are creating applications for the future. The Cocoa environment provides an advanced, object-oriented programming environment for creating, in Apple's words, "the best next generation applications."
Cocoa is a set of frameworks with programming interfaces in both Java and Objective-C. It's based on the integration of Apple technologies, Java, and OpenStep. To be more precise, it's based on the OpenStep operating system technology of NeXT (the company that Steve Jobs formed after leaving Apple, but which Apple later purchased bringing Jobs back to the company). Cocoa is an extension to the original OpenStep APIs that were present in OpenStep 4.x. Cocoa is a third generation set of APIs, although few changes were involved in the evolution of changes required to go from OpenStep to Cocoa.
The nifty thing about Cocoa is that developers can use it to write code in terms of "objects" that let them reuse up to 90 percent of their code for future work. And functions published in the operating system as a "service" can be accessed by other Cocoa applications. For instance, a grammar checker in a word processing application could be offered as a "service" and used by other programs.
Apple says that Cocoa is the most advanced object-oriented technology on the market today. Developers can write applications up to 10 times faster in Cocoa, according to Apple and the developers with whom we spoke.
By the way, Cocoa includes Java packages that let you develop a Cocoa application using Java as the development language. Apple says you can mix "within reason" the APIs from these packages and native Java APIs.
Both Cocoa and Carbon give the developer access to the advanced features of Mac OS X. Carbon combines earlier Mac OS compatibility with native functionality on X.
As a developer, your interest in the two different environments depends on whether you're moving a current software package to OS X or building one from scratch. For we end users, the importance of the two environments is that they should work in tandem to ensure lots of Mac OS X applications soon, and then some new -- and hopefully groundbreaking -- apps down the road.
All techno-speak aside, Carbon offers developers a smooth transition from Mac OS 9 to Mac OS X. Cocoa makes it possible to build rapid, advanced, software products. Both will play an important role for Mac OS X in the days ahead.
By the way, much of the information in today's column came from "Insider Mac OS X: System Overview," a publication of the Apple Developer Connection.
There will not be a "Road" column next week, as the entire MacCentral gang will be covering Macworld San Francisco.
(Note: Mac OS X is the upcoming, "next generation" operating system from Apple, due in the first half of 2001. Mac OS X will include components of the traditional Mac OS, as well as components of the Rhapsody project. Rhapsody was once planned as Apple's next generation operating system. It's still around as Mac OS X Server, and parts of Rhapsody technologies will become part of Mac OS X. Rhapsody/Mac OS X Server is partially based on OpenStep technologies that Apple obtained in the purchase of the NeXT company. Carbon is the modified version of the Mac OS application programming interfaces (APIs) that lets applications be rewritten with relative ease for Mac OS X.)
This story, "Road to Mac OS X: Carbon versus Cocoa" was originally published by PCWorld.