Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 7.4


Book: Cocoa Programming for Mac OS X (Third Edition)

Issue: 7.4 (May/June 2009)
Author: Dave Mancuso
Article Description: No description available.
Article Length (in bytes): 6,917
Starting Page Number: 10
Article Number: 7402
Related Web Link(s):


Full text of article...

Cocoa Programming for Mac OS X is widely considered the major book in its field. If you're interested in Cocoa development, this is the book to get. The second edition was considered a landmark, and the third edition was long awaited. The book is based on the Big Nerd Ranch's Cocoa course. This course is a boot camp on Cocoa development for OS X. The ranch itself is located in Georgia, and the classes are intensive. Courses are located on site, isolating participants so that they can best concentrate on the subject. The schedule is structured to maximize topic absorption while minimizing stress through things like a daily forest walk in the afternoon. Cocoa Programming for Mac OS X is the book without the ranch and live instructor.

The book's author is Aaron Hillegass, a longtime programmer who worked for both NeXT and Apple, Inc. He teaches at the Big Nerd Ranch and his main course is about Cocoa development. His writing clearly demonstrates a mastery of programming languages and the realities in which they're developed and operated. Anecdotes in the book are funny, but not just for show. Each story illustrates a concrete point about software design and development. Hillegass explains the history of NeXT and Cocoa very concisely, giving a quick overview of how Cocoa progressed from its origins to the present. In another section, he relates a story about the ill-fated Apple and IBM venture Taligent, explaining in no-nonsense terms why Taligent was doomed to failure (too much coding, too much subclassing, just too much programming in the way of creating even a simple "Hello, World" application).

Note that the book is not a text on Objective-C, but it covers a great deal of Objective-C concepts and code. All code in the book is Objective-C. Essentially, you can pick up a good deal of Objective-C without any external resources, especially if you're familiar with other programming languages. Objective-C language topics were well discussed. I was glad to see that the author didn't skip explaining even simple things in the language, for instance how Types and Constants are handled in Objective-C. I appreciated coverage of things like Key-Value Coding and Key-Value Observing (getting and setting variable values by name). It was good to see that a book on Cocoa frameworks didn't ignore the language it based the material on.

The book begins by providing a good layout of Cocoa and Mac windowing systems, and moves on quickly to things like Interface Builder. It leads you through OS X's garbage collection and memory management, CoreData (and how CoreData works in OS X), application notifications and how to properly utilize them, and other key topics. It was funny to read the terminology (NSOject, Nibs, etc.) and get firsthand information on how these terms are left over from old NextStep terminology.

The book provided more than history and example anecdotes. For most topics it laid out development technical problems and then described alternate solutions. It then summarized by explaining what Apple decided to go with and what effects the solution had. I found that it helped greatly to understand why a particular approach was taken with the Cocoa frameworks and Objective-C language. It made the exercises more clear when the background was explained. It also helped that the author usually compared how Cocoa handled things in contrast to C++, Java, and other languages. Cocoa understanding was enhanced by learning how common issues were dealt with in other programming languages and development paradigms.

The book didn't have major sections of chapters, but it spent the first few chapters going through most of the basic things you need for an application. The next few chapters then came back through with a deeper level of programming, and the last few chapters went even deeper (and broader). This helped the reader build a fully featured program as quickly as possible, and then add depth to it later on.

Cocoa Programming for Mac OS X gets fairly technical throughout the book, but strives to keep things clear and concise. It's interesting to note that if the reader has extra questions beyond the text, the author highly commends the reference documentation and the XCode help system for questions. I suppose this isn't much different from the REALbasic references in the IDE help system, but it's a much different scenario from a few years ago when help systems were sketchy answers to programming problems.

One nice touch was the "For the More Curious" sections of the book. The text had Challenge exercises as do most textbooks, but several sections had extra material for those who wanted more details on issues and topics. These "For the More Curious" pages were interesting to read and often gave concrete strategies and tips about adding abilities to your Cocoa applications.

Reading Cocoa Programming for Mac OS X is the next best thing to taking the Big Nerd Ranch course. It's clear from the material that Hillegass is a master teacher. In fact after reading the book, the reader will likely feel motivated to take the full onsite Cocoa course at the ranch (http://www.bignerdranch.com). It's always difficult to get around the fact that REALbasic is a multiplatform development environment, but it was enjoyable to learn more about Cocoa. It's my hope that this book will lend itself to better Cocoa framework development with REALbasic when Cocoa integration is unveiled.

End of article.