Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Apple > Operating Systems

This chapter is from the book

The Layers of Mac OS X: Application Environments

The main thing you do when you are in Aqua is use applications. On the surface, almost all applications in Mac OS X appear to function in a similar way: You launch them; you use commands from their menus; you quit them. Mac OS X has some fundamentally different types of applications, however. As a troubleshooter, you need to understand these categories.

Cocoa

The Cocoa environment is unique to Mac OS X—that is, software developed via Cocoa uses Mac OS X-only programming tools, and the finished application runs only in Mac OS X. The advantage of Cocoa-based software is that it potentially can take advantage of every feature built in to Mac OS X. The TextEdit application that comes with Mac OS X is an excellent example of such an application. Its Font Panel window, its spelling checker, and its capability to access Services from the Services command in the TextEdit menu are all, at least in part, due to the fact that TextEdit is a Cocoa-based application. Other types of applications will not be have such features or will be much less likely to include them. In non-Cocoa applications, items in the Services menu are likely to be dimmed and unselectable; they will have a Fonts menu instead of a Font panel, and so on.

Apple probably hopes that down the road, almost all Mac OS X applications will be Cocoa-based. But for now, they are relatively uncommon, because writing a Cocoa-based application means pretty much starting from scratch. If you already have written a Mac OS 9 application that you now want to get to work in Mac OS X, Cocoa would not be the fastest way to go.

Carbon

Applications written for the Carbon environment also run in Mac OS X. In most cases, a user would be hard-pressed to tell whether a particular application is Cocoa-based or Carbon-based. Carbon-based (or Carbonized) applications can offer all the basic Aqua features that you expect to find in Mac OS X, such as the look and feel of its windows. You cannot look at an application in the Finder and see quickly whether it is a Cocoa or a Carbon application.

To some extent, however, when a developer Carbonizes an application, he can decide how much of the Aqua interface features to support. As a result, some Carbon applications may look and feel more like Mac OS X applications than others do.

Carbon exists for two main reasons. First, it reduces the development time needed for rewriting existing Mac OS 9 applications to work in Mac OS X. That's why major Mac OS 9 applications, such as AppleWorks and Microsoft Office, are Carbonized applications rather than Cocoa ones. Second, some developers find it preferable even when they're starting from scratch. REALbasic, for example, is a programming language that creates Carbonized applications for Mac OS X.

Making matters a bit more complicated, Carbon applications have two distinct subcategories. Their difference depends on an OS feature called a library manager. Library managers are special programs that prepare other, more "ordinary" programs to be run. Library managers exist in both Mac OS 9 and Mac OS X. Carbon applications in Mac OS X can use two different types of library managers. Bear with me as I introduce some esoteric jargon:

  • CFM (code fragment manager) is essentially the same as the CFM used in Mac OS 9. It works with an application's executable binary code, which is in a format called PEF (for Preferred Executable Format). Unfortunately, this format is not preferred in Mac OS X.

  • Dyld (dynamic link editor) is the manager that only Mac OS X uses. It works with an executable binary-code format called Mach-O. Mach-O format is what Mac OS X's kernel uses; it is derived from Unix.

Exactly what all these managers and formats do, and how they differ, need not concern you. What does matter is the following:

  • CFM is not optimized for Mac OS X. Mac OS X is a native dyld platform. This means that for CFM-based programs to work, they must bridge to the dyld platform via Carbon routines. This bridging step takes time, resulting in a performance penalty that dyld-based software does not have—that is, CFM-based software will not run as fast in Mac OS X as the same program would if it had been written to use dyld instead.

    The most visible sign of this bridging is the LaunchCFMApp application. The file itself is located in /System/Library/Frameworks/Carbon.framework/ Versions/A/Support/LaunchCFMApp. More important, this file (which is an updated version of the Mac OS 9 Code Fragment Manager) is used every time you launch a CFM-based application. In fact, if you launch ProcessViewer and look at the list of open applications in User Processes, you won't see any of the CFM-based applications by name. Instead, you will see multiple instances of LaunchCFMApp . This intermediary causes the performance hit for CFM-based applications. LaunchCFMApp is itself a Mach-O program.

    Figure 4.1Figure 4.1 LaunchCFM App items in Process Viewer.


    Also, CFM applications, although they can be packages, may still use the single file format common in Mac OS 9. Thus, if you open the contextual menu for an application and no Show Package Contents command is listed, the application is almost certainly a CFM application. Dyld software will always use the preferred package format.

    SEE

    "Technically Speaking: Understanding Packages," in Chapter 2.

  • Dyld (Mach-O) software cannot run in Mac OS 9. So why bother with CFM at all? Two reasons. First, it may be easier to convert an existing Mac OS 9 application to its CFM-based cousin than to a dyld one. Second, CFM-based programs can run equally well in Mac OS 9 and Mac OS X. Thus, you need only one application for both environments. Dyld-based software runs only in Mac OS X. By the way, Cocoa-based software also uses Mach-O.

    For those who want a dyld-based Carbon program to run in Mac OS 9 and Mac OS X, a solution is to create two versions of the application, a CFM version and a dyld version. These versions can be combined into an application package that appears as a single file in the Finder. When the application is launched in Mac OS 9, however, the CFM version will be used; in Mac OS X, the dyld version will run. This situation allows the optimized version for each OS to be used with its respective OS. Actually, this type of division is more common with Classic and Carbon software versions in the same package, as described a bit later in this chapter.

When a program is said to be a native Mac OS X program, this generally means that it is either a Cocoa program or a dyld Carbon one (although some people consider any Carbon application to be native).

TAKE NOTE

Faceless Applications; Hidden Applications

Some applications run without an icon in the Dock or without being listed in the Force Quit window. Such applications are often called faceless applications, as they run without any user interface. The log-in window application, discussed in Chapter 5, is an example.

You can also simulate the effect of a true faceless application by setting it to launch at log in (via choosing it in the Login Items list in the Login System Preferences window, and checking the Hide checkbox). Installers for some applications automatically set up software this way. iTunes does this with the iTunes Helper application (which is actually located within the iTunes package).

Be careful when you hide an item in the list. You might lose its functionality. When I chose to hide items that created menus in the menu bar, for example, the menus no longer appeared.

This Login Items type of hiding is separate from hiding the windows of open applications, as you can do by holding down the Command and Option keys when clicking an application icon in the Dock. This technique hides the windows of all open applications except the one you clicked. Shareware utilities such as ASM, which mimics the Mac OS 9 Application menu, offer similar window-hiding options.

SEE

"Take Note: Dock and Finder Shortcuts," in Chapter 3, for more details.

Figure 4.2Figure 4.2 Note the Hide checkboxes in the Login Items list.


TAKE NOTE

Identifying Application Formats

Suppose that you needed to know whether a given application is Cocoa, Carbon-cfm, Carbon-dlyd, or Classic. What's the fastest way to find out? A utility called Get Info for App works great—if it works (in the most recent versions of Mac OS X it kept crashing on me). Just drag the application in question to the Get Info for App icon, and a window will open that shows you what you want to know.

For TextEdit, for example, you will see that the Framework is Cocoa and the Binary Kind is Mach-O.

On the other hand, if you select Internet Explorer, the window will say Carbon for the Framework and CFM for the Binary Kind.

As an alternative, you can use the ever-handy XRay. It does not distinguish between CFM vs. Mach-O, but it does distinguish between Cocoa, Carbon, and Classic applications.

Figure 4.3Figure 4.3 Three applications as listed in XRay. Note the Kind line distinction of Cocoa, Carbon, and Classic 68K.


Classic

Mac OS 9 programs that have not been Carbonized can still run in Mac OS X, but this capability requires a special trick. Mac OS X needs to launch what is called the Classic environment. I discuss this topic in detail in Chapter 9. For now, here's a brief summary of what happens. When you launch Classic, a working version of Mac OS 9 (including extensions and control panels) is loaded. The Mac OS 9 application then runs in this environment. In many ways, going back and forth between the two environments is almost seamless. You can cut and paste from a Classic program to a Mac OS X one, for example. Classic can even borrow your Mac OS X Internet and printer settings, so Classic applications can maintain access to the Web and to your connected printers.

Still, running a program in Classic has a huge disadvantage: You are not really using Mac OS X and thus get almost none of the advantages of running Mac OS X. Running an application in Classic is pretty much like running it in Mac OS 9, and maybe even a bit worse; it will likely run slower and have more potential conflicts than if you booted from Mac OS 9. The sole advantage of Classic is that it allows you to run Mac OS 9 programs that otherwise would not run in Mac OS X. As time goes by, however, you will want to find Mac OS X alternatives to these applications (or hope that Mac OS X versions of them get released) so that you can reduce your use of Classic to zero.

SEE

Chapter 9 for more information on the Classic environment.

Java

Mac OS X can run programs written in Java. Most users, if they are familiar with Java at all, think of it as being something used by certain Web sites and accessed from your Web browser. But Java software can be created to run independently of a browser. and Mac OS X is set to do this. Apple has even provided a means for developers to incorporate Mac OS X's Aqua interface into Java code so that a Java application can have the look and feel of a typical Mac OS X application. The main advantage to Java, for the programmer, is that Java is platform-independent. The same Java software (with some minor modifications to accommodate the platform's user interface) can run on any computer that supports the use of Java, including a Windows PC. At present, few Java applications are available for Mac OS X. The jury is still out as to whether Java will someday play a significant role in Mac OS X.

Putting it together

All these application environments are unified within the Aqua interface. There are signs—some subtle, some obvious—that occur when you shift from Classic to Carbon to Cocoa to Java applications. Still, one of the great successes of Mac OS X is that you can accomplish these switches almost effortlessly. And at least most of the time, it all works as Apple intended.

One other type of application that can run in Mac OS X: Unix software. I discuss it in "Darwin" later in this chapter.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.peachpit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020