Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Application Environments

Applications are by far the predominant type of software created for Mac OS X, or for any platform. Mac OS X provides numerous environments for developing applications, each of which is suited for specific types of development. The following sections describe each of the primary application environments and offer guidelines to help you choose an environment that is appropriate for your product requirements.

Important: With the transition to Intel-based processors, developers should always create universal binaries for their Carbon, Cocoa, and BSD applications. Java and WebObjects may also need to create universal binaries for bridged code. For information on how to create universal binaries, see Universal Binary Programming Guidelines, Second Edition.

In this section:

Cocoa
Carbon
Java
AppleScript
WebObjects
BSD and X11


Cocoa

Cocoa is an object-oriented environment designed for rapid application development. It features a sophisticated framework of objects for implementing your application and takes full advantage of graphical tools such as Interface Builder to enable you to create full-featured applications quickly and without a lot of code. The Cocoa environment is especially suited for:

The objects in the Cocoa framework handle much of the behavior required of a well-behaved Mac OS X application, including menu management, window management, document management, Open and Save dialogs, and pasteboard (clipboard) behavior. Cocoa’s support for Interface Builder means that you can create most of your user interface (including much of its behavior) graphically rather than programatically. With the addition of Cocoa bindings and Core Data, you can also implement most of the rest of your application graphically as well.

The Cocoa application environment consists of two object-oriented frameworks: Foundation (Foundation.framework) and the Application Kit (AppKit.framework). The classes in the Foundation framework implement data management, file access, process notification, memory management, network communication, and other low-level features. The classes in the Application Kit framework implement the user interface layer of an application, including windows, dialogs, controls, menus, and event handling. If you are writing an application, link with the Cocoa framework (Cocoa.framework), which imports both the Foundation and Application Kit frameworks. If you are writing a Cocoa program that does not have a graphical user interface (a background server, for example), you can link your program solely with the Foundation framework.

Apple’s developer documentation contains a section devoted to Cocoa where you can find conceptual material, reference documentation, and tutorials showing how to write Cocoa applications. If you are a new Cocoa developer, be sure to read Cocoa Fundamentals Guide, which provides an in-depth overview of the development process for Cocoa applications. For information about the development tools, including Interface Builder, see “Mac OS X Developer Tools.”

Carbon

Based on the original Mac OS 9 interfaces, the Carbon application environment is a set of C APIs used to create full-featured applications for all types of users. The Carbon environment includes support for all of the standard Aqua user interface elements such as windows, controls, and menus. It also provides an extensive infrastructure for handling events, managing data, and using system resources.

The Carbon environment is especially suited for:

Because the Carbon interfaces are written in C, some developers may find them more familiar than the interfaces in the Cocoa or Java environments. Some C++ developers may also prefer the Carbon environment for development, although C++ code can be integrated seamlessly into Cocoa applications as well.

The Carbon APIs offer you complete control over the features in your application; however, that control comes at the cost of added complexity. Whereas Cocoa provides many features for you automatically, with Carbon you must write the code to support those features yourself. For example, Cocoa applications automatically implement support for default event handlers, the pasteboard, and Apple events, but Carbon developers must add support for these features themselves.

In Mac OS X v10.5 and later, Carbon includes support for integrating Cocoa views into your Carbon applications. After creating the Cocoa view, you can wrap it in an HIView object and embed that object in your window. Once embedded, you use the standard HIView functions to manipulate the view. Wrapped Cocoa views can be used in both composited and noncomposited windows to support views and controls that are available in Cocoa but are not yet available in Carbon. For more information, see Carbon-Cocoa Integration Guide and HIView Reference.

The Carbon application environment comprises several key umbrella frameworks, including the Carbon framework (Carbon.framework), the Core Services framework (CoreServices.framework), and the Application Services framework (ApplicationServices.framework). The Carbon environment also uses the Core Foundation framework (CoreFoundation.framework) extensively in its implementation.

Apple’s developer documentation contains a section devoted to Carbon, where you can find conceptual material, reference documentation, and tutorials showing how to write applications using Carbon. See Getting Started with Carbon in Carbon Documentation for an overview of the available Carbon documentation.

If you are migrating a Mac OS 9 application to Mac OS X, read Carbon Porting Guide. If you are migrating from Windows, see Porting to Mac OS X from Windows Win32 API. If you are migrating from UNIX, see Porting UNIX/Linux Applications to Mac OS X.

Java

The Java application environment is a runtime environment and set of objects for creating applications that run on multiple platforms. The Java environment is especially suited for:

The Java application environment lets you develop and execute 100% pure Java applications and applets. This environment conforms to the specifications laid out by the J2SE platform, including those for the Java virtual machine (JVM), making applications created with this environment very portable. You can run them on computers with a different operating system and hardware as long as that system is running a compatible version of the JVM. Java applets should run in any Internet browser that supports them.

Note: Any Mach-O binaries that interact with the JVM must be universal binaries. This includes JNI libraries as well as traditional applications that invoke the JVM. For more information, see Universal Binary Programming Guidelines, Second Edition.

For details on the tools and support provided for Java developers, see “Java Support.”

AppleScript

The AppleScript application environment lets you use AppleScript scripts to quickly create native Mac OS X applications that support the Aqua user interface guidelines. At the heart of this environment is AppleScript Studio, which combines features from AppleScript with Xcode, Interface Builder, and the Cocoa application framework. Using these tools, you can create applications that use AppleScript scripts to control a broad range of Cocoa user-interface objects.

AppleScript Studio has something to offer both to scripters and to those with Cocoa development experience. In addition to AppleScript’s ability to control multiple applications, including parts of the Mac OS itself, you can use it for the following:

For information on how to create applications using AppleScript Studio, see AppleScript Studio Programming Guide.

WebObjects

The WebObjects application environment is a set of tools and object-oriented frameworks targeted at developers creating web services and web-based applications. The WebObjects environment provides a set of flexible tools for creating full-featured web applications. Common uses for this environment include the following:

WebObjects is a separate product sold by Apple. If you are thinking about creating a web storefront or other web-based services, see the information available at http://developer.apple.com/tools/webobjects.

Note: If your WebObjects application includes bridged code in a Mach-O binary, you need to create a universal binary for the Mach-O binary code. For more information, see Universal Binary Programming Guidelines, Second Edition.

BSD and X11

The BSD application environment is a set of low-level interfaces for creating shell scripts, command-line tools, and daemons. The BSD environment is especially suited for:

The BSD environment is for developers who need to work below the user interface layers provided by Carbon, Cocoa, and WebObjects. Developers can also use this environment to write command-line tools or scripts to perform specific user-level tasks.

X11 extends the BSD environment by adding a set of programming interfaces for creating graphical applications that can run on a variety of UNIX implementations. The X11 environment is especially suited for developers who want to create graphical applications that are also portable across different varieties of UNIX.

The BSD environment is part of the Darwin layer of Mac OS X. For information about Darwin, see Reference Library > Darwin. For more information about X11 development, see http://developer.apple.com/darwin/projects/X11. See also “Information on BSD” for links to additional BSD resources.



< Previous PageNext Page > Hide TOC


Last updated: 2007-10-31




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice