Thursday, March 5, 2009

Book Review: iPhone Developer's Cookbook

I just finished Erica Sadun's The iPhone Developer's Cookbook: Building Applications with the iPhone SDK.
I found it to be incredibly helpful. Over the past few weeks as I've been working my way through it, I've frequently referred back to it as I work on features in my own applications.

The book is squarely aimed at developers who already know Objective-C well and have at least some clue as to how modern event driven GUI frameworks function. If you're coming from a web development background, or are still getting up to speed with C and Objective-C concepts, you may find this book frustrating.

Erica starts with a simple "hello, world" style application with a simple UI built programmatically without using Interface Builder and nib files. Subsequent recipes build on the "hello, world" app. The code examples are tightly focused but sometimes omit boilerplate declarations and glue code -- generally a good thing since Objective-C is fairly verbose. I was always able to follow the examples and any omissions seemed self-evident to me, but an Objective-C newbie might get lost at a couple of points.

Though it's a cookbook, the chapters build in a logical progression, covering views, view controllers, alerts and status indicators, two chapters on tables, multimedia, form controls and services like the address book and core location. Some topics, such as audio processing or SQLite, deserve books of their own; Erica simply scratches the surface.

One notable topic not covered is OpenGL ES -- prospective game programmers need look elsewhere. My one small criticism of the book is the number of examples using undocumented or private APIs. Erica's obviously spent a lot of time spelunking around Cocoa Touch's innards, and while it's cool to play around with things you find there, if your aim is to publish apps in the App Store, undocumented APIs aren't really very useful. But they are clearly labeled in the text, and Erica does talk about the pitfalls of using undocumented calls in the first chapter.

My biggest praise is for showing how to build up an application without nibs. I found Interface Builder and nib files very convoluted and opaque at first. Erica's "hello, world" app helped me understand the relationship between the main() function, the application delegate, the window and the root view.

No comments: