Blog Post

Book Review: Cocoa® Programming for Mac® OS X, Third Edition

Stay on Top of Enterprise Technology Trends

Get updates impacting your industry from our GigaOm Research Community
Join the Community!

Addison Wesley Professional started shipping the Third Edition of Cocoa Programming for Mac OS X by Aaron Hillegass this month. Hillegass’ book is considered my most to be the de-facto intro-to-OS X programming text. I own (and have now recycled) the first edition of the book and have gone through the majority of the Third Edition (at least reading-wise). Here’s my take on this latest incarnation.

The Text At A Glance

Aaron has a great, teaching-writing style. You definitely get the feel of being in the classroom, learning right from the professor. The preface makes at least two, fairly substantial claims. First, that the nook covers the Objective-C language, Cocoa design patterns and how to use Xcode, Interface Builder and Instruments. And, second, that you will learn 80% of what you need to know to get started programming for the Mac. I have to agree with both claims as you will definitely learn a great deal of the fundamentals of the language and tools and that the book can be used as a reference post-read.

This third edition has been updated to cover Leopard-only technologies (such as garbage collection and Objective-C 2.0) and does a decent job showing where to utilize the new language features and delves into the depths of intricacies of the new memory management facilities in Leopard (and how to code for both Tiger & Leopard). Covering tools like gdb and Instruments is an amazing thing to do, since many programmers are still rely solely on printf or (in the case of Mac programming) NSLog.

The sample applications range from trivial to pretty neat & indicative of real-world Mac programming, error-logic and all. I especially like the challenges in the exercises, many of which have you modify example code, sometimes accompanied by the mantra: “This is hard, and you are not stupid.”

If you are interested at all in programming for OS X or have programmed for the Mac and want to pick up some hints on how code specifically for features in Leopard, Aaron’s books is a must-buy. I’d definitely recommend keeping all of Apple’s updated Objective-C 2.0 information handy as it will fill in the 20% Aaron doesn’t cover and go a bit deeper as well.

The Gory Details

Here is a breakdown of the chapters and what each covers:

  • Chapter 1. Cocoa: What Is It?
  • Chapter 2. Let’s Get Started
  • Chapter 3. Objective-C
  • Chapter 4. Memory Management
  • Chapter 5. Target/Action
  • Chapter 6. Helper Objects
  • Chapter 7. Key-Value Coding; Key-Value Observing
  • Chapter 8. NSArrayController
  • Chapter 9. NSUndoManager
  • Chapter 10. Archiving
  • Chapter 11. Basic Core Data
  • Chapter 12. Nib Files and NSWindowController
  • Chapter 13. User Defaults
  • Chapter 14. Using Notifications
  • Chapter 15. Using Alert Panels
  • Chapter 16. Localization
  • Chapter 17. Custom Views
  • Chapter 18. Images and Mouse Events
  • Chapter 19. Keyboard Events
  • Chapter 20. Drawing Text with Attributes
  • Chapter 21. Pasteboards and Nil-Targeted Actions
  • Chapter 22. Categories
  • Chapter 23. Drag-and-Drop
  • Chapter 24. NSTimer
  • Chapter 25. Sheets
  • Chapter 26. Creating NSFormatters
  • Chapter 27. Printing
  • Chapter 28. Web Service
  • Chapter 29. View Swapping
  • Chapter 30. Core Data Relationships
  • Chapter 31. Garbage Collection
  • Chapter 32. Core Animation
  • Chapter 33. A Simple Cocoa/OpenGL Application
  • Chapter 34. NSTask
  • Chapter 35. The End

(Choosing to cover topics such as threading is a huge plus and not the normal faire for this type of text)

Full book reference information:

Title: Cocoa® Programming for Mac® OS X, Third Edition
Publisher: Addison Wesley Professional
Publish Date: May 05, 2008
Print ISBN-10: 0-321-50361-9
Print ISBN-13: 978-0-321-50361-9
eText ISBN-10: 0-321-56273-9
eText ISBN-13: 978-0-321-56273-9
Pages: 464

You can find it at Amazon (they even have a Kindle-ready version), Safari Books Online and (most likely) at your favorite local bookstore.

List price is $49.99 USD but you can find it in the low $30’s if you poke around.

If you snagged a copy of the tome, drop a note in the comments with your take on the text.

12 Responses to “Book Review: Cocoa® Programming for Mac® OS X, Third Edition”

  1. I have to agree with Sravan. Although I think this is a great book; well set out and paced, I feel confused about Memory Management. I don’t know when or how to use it properly.

    I got my book two days ago and I am on Chapter 7. It is not boring, it really reels you in. A very good book for beginners. I had no experience with Cocoa or Objective-C when I started (although I am very skilled in C++) and now I feel confident about writing code.

    The challenges are just the right level of difficulty and when you use the material and examples covered from all chapters, they are very doable. I was actually hoping that the book would have something like these challenges as I feel they are fundamental for learning the concepts.

    The writing style is, as I said, captivating and assuring. It feels like an actual person is there guiding you, not like a reference document.

    I highly recommend this book.

  2. I just got this book the this week and i have gone through the first 7 chapters and find it very easy to use. I have good programming knowledge in the windows world especially with java (And c, c++) and the apple introduction to objective c was too slow for me. I love the pace of this book. I aim to do a chapter every two days – one for the chapter and one for the challenges.

    I am loving the challenges as they allow me to internalize the concepts shown in the book.

    Only one comment – with iPhone SDK not supporting garbage collection, i would prefer a bit more meat into memory management the old style. I am not sure if what i am doing is correct or not from a memory management perspective. I tried doing the dealloc classes for a few more examples, i keep running into the problem of the objects being released prematurely. I think i dont understand that part well.

    Other than that, i think this is a great book for a first timer to MAC.

  3. This is the error I get when I try to compile and run any thing *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason : ‘Cannot create BOOL from object of class _NSControllerObjectProxy’ This same error comes up on things that used to run fine.

  4. I had downloaded some chapters from the internet as this book wasn’t available in India but I found it to be a great book for somebody learning up front that I had to order it from
    I got mine in March. I’ve been studying it at a steady pace but Aaron explains it well. A good buy if you wanna start development on the MAC.

  5. I’ll second Victor’s comments – I received my copy last weekend, and I’m working through it now. I have quite a bit of experience programming on Windows, but when I started looking into Mac programming, I just didn’t know where to start. This book has been a great help to get me going on Mac development.

  6. Nicolas Ivy

    Thanks for blogging about this book! I’ve been working out of a well-beaten copy of the first edition, and despite much TLC administered, the poor thing’s falling apart. I’ve been meaning to look for a used copy on Amazon, but now it looks like I don’t have to.

    Stumbled upon this blog not too long ago looking for Quicksilver video tutorials. Glad I bookmarked it.

  7. Scott Freer

    This is a great book. The only thing better is the course Aaron teaches at the Big Nerd Ranch – he uses this book as the course material. I took the course this April and it was well worth the money. If you want a jumpstart into Cocoa development, the Cocoa course is perfect.


  8. Victor

    I received mine last Monday. I have no programming experience in Mac, but I am moving along at an amazing speed. I am in chapter 7 and so far I have nothing to complain. Great buy.

  9. Given all the currently shipping Macs now have 2+ cores, threading MUST be included these days. Yes, I realize it can be complicated, and no I haven’t read this book as of yet.. But having programmed for the past 15 years in multi threading environments, I can attest to how brutally painful it is to use (let alone work on / fix) programs which obviously haven’t taking threading into account. Even relatively new products (Aperture!) which by all accounts should have done it right given their age, don’t.. So lets, please!, change this thought of “threads are too hard for beginners” and find a way to set this world up to use the 16+ cores we’re soon to have..