Free Newsletters
InfoWorld Daily

InfoWorld
Log-in | Register

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.

 The Bottom Line

Apple Mac OS X 10.5 (Leopard)
Apple, http://apple.com

Preview  

Ship Date:
October 2007

Cost:
Leopard client OS, $129, including Xcode development tool suite and all features described herein

Bottom Line:
Mac apps share an unfailingly consistent look, feel, cross-app integration, and user-focused core feature set, thanks to Cocoa and other object-oriented frameworks. They enforce platform standards by defining one right way to do everything, and they do it so easily and flexibly that developers don't want or need to create nonstandard features, such as spell- and grammar-check. When using 2-D and 3-D graphics and text, apps optimize themselves for the best mix of CPU and GPU utilization for each user's system. Even low-level optimization for multicore and multiprocessor systems is handled through a high-level API. It's not impossible to write slow, platform-inconsistent, or ill-behaved Mac apps, but you have to work awfully hard at it.

About our Reviews and Scoring Methodology

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.

Compelling scripts
Cocoa provides hooks for making applications scriptable, that is, usable as services by other Mac platform apps. The scripting interface to Mail, for example, is not merely capable of invoking a message composition window. A script that interacts with Mail can extract messages from the inbox, perform searches, and create rules to govern the handling of incoming mail. OS X incorporates an elaborate but thoroughly abstracted dynamic remote procedure invocation mechanism for native applications. It's based on messages, as is all of Cocoa, and is therefore far more robust than one would expect from interpreted scripts.

While Cocoa's scripting support exceeds other platforms' capabilities, it has been practically limited to script-to-application interaction, that is, invoking calls into Cocoa applications from external scripts. Oddly, as useful as it would be to do so, it's extremely difficult to invoke calls to Cocoa applications from other Cocoa apps.

In Leopard, Cocoa addresses this. A new facility, Scripting Bridge, generates Objective-C code that effectively turns scriptable Cocoa applications into objects whose methods can be invoked from other Cocoa applications; hooking two or more applications together requires no middleware. One inherits this capability simply by adopting Cocoa.

Tom Yager is chief technologist of the InfoWorld Test Center. He also writes InfoWorld's Ahead of the Curve and Enterprise Mac blogs.
Continued
1 | 2 | NEXT PAGE » 


Talkback:

commentPost a Comment

 

MOST COMMENTS

 
 





Migrating to Vista
Join Windows Vista Expert, Richard Whitehead as he presents the benefits and challenges of migrating to Windows Vista. Sponsored by Novell

»  Click here to view this Webcast
  The Path to Enterprise Security
This is your comprehensive guide to Enterprise Security. In it you'll find solutions to the most pressing security threats facing you and your company. Learn the latest on insider threats and how to effectively minimize risk within your organization. Sponsored by Nokia

»  Click here to download now

- Special Advertising Partners -
WHITE PAPERS
 

» Technology White Papers Library

Technology White Papers by Topic

Technology White Papers E-mail Alert

Find out when the latest white paper is available:
 
 
INFOWORLD MARKETPLACE
 
» BUY A LINK NOW
 
 

Video

 
 
 

Podcasts

 
IFW Daily 10/07/2008

AMD to split into two companies, SAP suffers from stock market turmoil...

 
 

 

Columnists

 
 
 

Resource Center


Ads by techwords beta  [See your link here]
 




Sponsored Technology Links

 
 
 HOME  NEWS  BLOGS  PODCASTS  VIDEOS  TECHNOLOGIES  TEST CENTER  EVENTS  CAREERS   About | Advertise | Awards | RSS | Contact Us 

Copyright © 2008, Reprints, Permissions, Licensing, IDG Network, Privacy Policy, Terms of Service.
All Rights reserved. InfoWorld is a leading publisher of technology information and product reviews on topics including viruses,
phishing, worms, firewalls, security, servers, storage, networking, wireless, databases, and web services.

CIO :: ComputerWorld :: CSO :: Demo :: GamePro :: Games.net :: IDG Connect :: IDG World Expo
Industry Standard :: IT World :: JavaWorld :: LinuxWorld :: MacUser :: Macworld :: Network World :: PC World :: Playlist