Datasheet

Figure 1-6
Each of these application frameworks is appropriate in different situations. In addition, these application
frameworks are not mutually exclusive. An application may draw on features from all three frameworks.
Cocoa
The Cocoa application framework provides programmers with a means of building feature-rich Mac OS X
applications quickly. The roots of Cocoa lie in NeXTSTEP, the operating system that powered NeXT com-
puters in the early 1990s. When Apple announced Mac OS X in 1998, the API was re-christened Cocoa,
and introduced alongside Carbon as Mac OS X’s application development strategy.
Cocoa is an object-oriented API written in Objective-C, an object-oriented language descended from
ANSI C and Smalltalk. Programmers work with Cocoa by creating objects and hooking them together in
various ways. Objects provide a convenient way for programmers to extend basic application function-
ality without having to design the entire application from the ground up. Put another way, Cocoa allows
you to focus on writing the code that makes your application unique, rather than forcing you to write
the code that all applications must share.
The Cocoa API is divided between two frameworks:
The AppKit framework (
/System/Library/Frameworks/AppKit.framework): Provides
high-level objects and services for writing applications, including Aqua user interface elements.
The Foundation framework (
/System/Library/Frameworks/Foundation.framework):
Provides objects and services useful for all programs, such as collection data types, Unicode
string support, and so on.
These features are separated into two separate frameworks so programs can use Foundation’s utility
classes without having to bring in a full graphic user interface; for example, a command-line tool written
in Objective-C might simply use Foundation.
In addition, Java bindings for Cocoa are available, allowing Java programmers access to AppKit and
Foundation objects. This book focuses on using Cocoa with Objective-C.
Carbon
What we know as Carbon today started out as the programmatic interface to the original Macintosh
operating system. Although sufficient for writing Macintosh applications, the API had some problems
Aqua User Interface
Applications
Core Operating System
Graphics and Media
Cocoa Java JDKCarbon
16
Chapter 1
05_573993 ch01.qxd 6/16/05 2:22 PM Page 16