Programming Mac OS X with Cocoa for Beginners/What is Cocoa?

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Next Page: Installing the developer tools

Cocoa is possibly one of the most rewarding, fun and productive ways to program a modern computer yet devised. If you own a Mac running Mac OS X, you already have Cocoa, and all the tools needed to program your Mac are available for free from Apple. Anyone who has an interest in programming can use Cocoa to write Mac applications, yet it is not just for beginners; many of the best OS X software titles available are written using Cocoa. You are able to harness the full power of the machine from Cocoa.

Programming using Cocoa involves both using a graphical user interface (GUI -- pronounced "gooey") tool to build your user interfaces, and an integrated development environment (IDE). Cocoa consists of hundreds of ready-built classes, which are pre-programmed modules of reusable code, that you can simply include in your own work. Since these classes are well designed, powerful and fully debugged, using them saves you hundreds of hours in building in complex functionality.

Cocoa is the name given to the complete set of classes, functions and constants, grouped together into an Application Programming Interface, or API. For building Mac applications Cocoa is the only API that is really used anymore. (The other APIs that used to be provided by Apple, the Classic API and the Carbon API have been deprecated.)

To get the most out of this text, you will need to be running Mac OS X 10.3 or later. If you have 10.2, most of what is here will work OK, but the tools as described will be different, and a little harder to use. The coding examples avoid Cocoa features that only exist on 10.3 or 10.4, but later chapters will explain them.

Significant parts of this text describe older versions of Interface Builder. Some of what is described will not work with version 3.0.

Above all, this text aims to get you started in the smoothest way possible, so that you can begin to see not just how powerful Cocoa can be, but also how much fun it is to work with.

Next Page: Installing the developer tools