Book (P)review: iOS Recipes

Jonathan Penn, May 09, 2011

(Aaron: hey look, I found someone to take me up on my offer for a guest post! Shoot me an email if you want to see your name on here, too. Also, a big thanks to Jonathan for stepping up and being the first in line. And, check out his website, Cocoa Manifest when you have a chance.)

Programming books you find on bookstore shelves can be worthless. Most are the learn-something-to-boast-like-an-expert-in-30-days variety. Many are copycat beginner books recycling the same material. Some are good. A few are fantastic.

I found a fantastic one.

And now for something completely different…

iOS Recipes is soon to be released from The Pragmatic Programmers written by Paul Warren and former Apple employee Matt Drance. It’s opinionated and does a great job sharing solutions with style. Not just style for code formatting aesthetics, there’s an architectural style involved, too. Should I use properties? Delegates or blocks? When should this behavior be broken out into a new object or kept where it is? What’s the best name for the method I want to write? This book has some great examples.

Just Like Mama Used to Make

Apple’s template generated code dumps a lot of stuff in the application delegate. All your Core Data setup methods are in there when they don’t need to be. One of the recipes in this book shows a good pattern for pulling all that out into a reusable class.

They also show how to setup a splash screen transition controller to animate away from the Default.png screen to the first view of the app. It’s a great example of using Apple’s delegation idioms to separate concerns. Again, you end up with something compact and reusable for other applications.

They have a bunch of good graphics recipes for 3D transforms, view manipulation, a particle emitter and composing views efficiently for animation. You’ll find advanced table view tricks for adding shadows and gradients, too.

And it’s all done with examples in Xcode 4. That makes this book a great way to learn the new editor. Of course, it would be much better to do it in vim (cough, cough), but that’s a rant for another post. :)

Who’s It For?

If you’re a novice who got through the intro material Apple provides, you’ll be able to read this with no problem. It assumes that you’ve at least tried to go through demo code before. And the book isn’t too basic for advanced devs, either. I learned a few things I didn’t already know, especially about the Objective C runtime. My biggest takeaway—-organizing components so they fit into a Cocoa mindset.

Writing your code with the system’s idioms is important. I’m not saying that you shouldn’t try new ideas or pull idioms in from other languages. But, for example, if you stray too far and too fast from American idioms when communicating with other Americans then you hamper understanding. In a similar way, working within the idioms of Cocoa help you communicate to yourself and other developers.

Definitely check out this book. You don’t even have to wait until it gets published. You can buy the eBook version now and get updates as they make changes.

Jonathan Penn is an independent developer and the mad scientist behind Navel Labs. He also purveys the fine commentary at Cocoa Manifest, a blog devoted to iOS resources, where this book review originally appeared. As an avid vim user, Jonathan thinks Apple’s support of emacs key bindings in Xcode is more egregious than their dubious use of patent lawsuits. He also likes cats.