Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL



Objective-C is a wonderful language that has received far less attention than it deserves. It has suddenly become (more) popular with the success of Apple's Mac OS X and iPhone, where it is the supreme development language. If you're going to learn a language to write applications for Mac OS X or the iPhone, Objective-C is the language to learn.

The Objective-C language does not feel like it was developed by a committee or a computer science major. It's a language for minimalists and anarchists. Yet it retains many of the features that make Java one of the great programming languages of our time. Objective-C lets you write applications that are every bit as structured and formal as anything you can write in Java. But at the same time, if you want to bore a hole through the language and head off in a direction where no one has gone before, it won't stand in your way.

After programming in Objective-C for a few years, I was struck at how "Java-like" my programs were. If I'd known then just how many of my Java techniques and concepts were directly transferable to Objective-C, it would have saved me months of study and experimentation. I wrote this book so that you can avoid the same fate.

Who This Book Is For

This book is for any Java developer interested in learning and exploring Objective-C as quickly as possible.

How This Book Is Structured

This book is organized into four parts: the Objective-C language, translating technologies, design patterns, and advanced Objective-C.

The first part describes the basics of the Objective-C language itself. It explains how Objective-C is like, and unlike, Java. It details the language syntax, class declarations, inheritance, and so on.

The second part examines specific technologies, like garbage collection, the file system, and introspection. Each chapter presents side-by-side examples of Java code and the equivalent code in Objective-C. Tables list the Java classes that you're familiar with along with the Cocoa classes that perform the same role. Each chapter then goes on to advanced topics, often exploring techniques unique to Objective-C.

The third part is organized by design pattern. Java developers use many important design patterns, such as the factory and Model-View-Controller patterns. These chapters show how each pattern is implemented in Objective-C—often in ways that may surprise you.

The final section of the book explores advanced Objective-C topics: memory management, integrating Objective-C with C, and the Objective-C runtime environment.

I strongly encourage you to read the first part in its entirety. The second and third parts can be read straight through, or you can skim them and refer back to them later for solutions. The advanced topics in the final section address specific situations, like working with the iPhone's memory manager, which can be explored as needed. Many chapters start out with the basics and then progress to more esoteric features, so feel free to skip to the next chapter once you've learned what you want.


This book assumes that you have some experience programming in Java. You should be familiar with the basics of the language, the concepts of classes, objects, inheritance, and interfaces, and have a working knowledge of the core Java classes. It will help if you have some functional knowledge of individual Java technologies, like introspection and exceptions, but these aren't absolutely necessary to learn the Objective-C equivalents. While I would hope that you are already familiar with design patterns, they aren't a prerequisite.

Downloading the Code

The source code for this book is available to readers at in the Downloads section of this book's home page. Please feel free to visit the Apress web site and download all the code there. You can also check for errata and find related titles from Apress.

Contacting the Author

You can reach me at

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint