A developer's-eye view of Leopard, part III
Cocoa and other sweet object-oriented frameworks magically make all Mac apps part of an integrated suite
Mac users have high expectations. A newcomer to the platform quickly discovers that all Mac applications share consistent appearance and behavior, are incomparably fast, and come with "Wouldn't it be great if I could …?" user interface experiments that tend to just work.
Mac developers are a remarkable lot, it's true, but they're not rolling all of this rich functionality, suite-like cross-app integration, and consistent behavior by hand. It's in the OS X frameworks. Rich text document and HTML editing, ubiquitous drag-and-drop, spelling- and grammar-checking, dictionary lookups, search, PDF export, hyperlinks, video and audio playback and recording, complex 2-D and 3-D rendering with CPU/GPU optimization, and so much more is integrated into the frameworks such that just picking a framework class to add a feature makes it Mac platform standardized and compatible.
Even when Apple supplies several approaches to achieving the same end in order to accommodate developers' various preferences, the company ensures that all those tactics result in a completely consistent user experience. No matter what software you add to a Mac, the whole system feels like an integrated suite.
Delicious Cocoa
Cocoa is the root framework, the primary API, for all native Mac applications written in Objective-C. There are wrappers and bridges that allow using some Cocoa facilities in other languages, including C, C++, Python, and Java, but the only way to suck all of the goodness out of Cocoa and the Mac's other object-oriented frameworks is to use Objective-C.
Now that Apple is using Objective-C for all of its application development, visual and functional elements that Apple builds into its programs are finding their way into Mac frameworks so that developers can evolve their apps into Leopard's updated look, feel, and feature set. It's surprisingly easy to do, and in some cases, developers don't have to lift a finger — not even recompile their code to add the features that weren't present in the Tiger release of their application.
The most accessible examples of the zero-effort Tiger-to-Leopard transformation are Text Services and unified window styles. In Tiger, all Cocoa applications that incorporate text-entry fields inherit OS X's spelling checker. The Cocoa framework that ships with Leopard adds a grammar checker that tries to flag awkward or improper sentence construction and various barriers to readability. Its smart quote support converts open and close quote pairs to tails-up, tails-down style in formatted documents and flat, HTML-friendly quotes for plain text. Hyperlinks found in a Cocoa text-editing field are automatically detected and rendered in a familiar standout underlined style that launches the browser by default. Multiple regions of selected text can be copied and pasted with the same ease as contiguous sentences and paragraphs. With Leopard, text attachments can also be edited inside a document being viewed without the need to pop up a text-editor window.
These might seem like small changes, but they add up to key functionality that developers previously had to code into their applications. As with all features that Apple adds to revisions of its frameworks, everything is optional, and everything can be superclassed to add functionality and make objects that implement an application-unique feature set without sacrificing consistency or compatibility.









