The Object of It All

So now you're probably thinking, "Great, but what's an object?" Objective-C is what computer scientists call an object-oriented language. You're going to be doing object-oriented programming as you develop your iPhone application.

Tip

If you're new to object-oriented programming, take a moment to read the Wikipedia page on this topic. The overview and history will help you come up to speed on the design motivations and terminology used in this style of programming: http://en.wikipedia.org/wiki/Object-oriented_programming.

Objects are chunks of memory that contain code and data for your application. One of the main tenets of object-oriented design is that your application should know as little as possible about the inner workings of an object. Terms like encapsulation and data abstraction describe this behavior.

An object should be like a black box. In fact, it may be helpful for you to use those square brackets as a visual reminder: [] looks a lot like a box.

As soon as you turn on your iPhone, thousands of objects are created in memory. Thousands more are added as soon as you launch your own application. You'll often hear instance used to describe each of these objects. With so many instances floating around, you'll need variables to keep track of the important ones.

Telling Your Objects to Do Things

The variables that reference objects let you change an object's behavior or state. You do this by sending a message to the object. In the Cocoa documentation, the object ...

Get iPhone App Development: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.