Dead Ink Vinyl

Musings of David L Kinney

Time to Learn Objective-C

Up to this point, I have avoided learning Objective-C and Cocoa. My professional software development is almost entirely Web-based or client-server applications and I haven’t had a lot of itches to scratch when using my Mac. The excellent independent developer community that surrounds the Mac has delivered all of the software I’ve desired and done it at very reasonable prices. Then there is the Objective-C language itself. Explicit memory management and dealing with some of C’s quirks (for example, processor directives) really feels like a step backward from Java and .NET. So there’s never been a lot of incentive for me to embrace Objective-C and Cocoa.

Then the iPhone SDK was released. As it happens, I have several itches to scratch on the iPhone. And the iPhone is a fun platform, too—I mean, there’s got to be some way for stodgy business applications to make use of the iPhone’s 3D motion sensors, right?

So this weekend I joined the iPhone developer program, downloaded the iPhone SDK, dusted off my copy of Cocoa Programming for Mac OSX, and got down to business. Since I have a strong object-oriented programming background due to my time with Java and I’m comfortable with weakly typed languages due to my time with PERL and Ruby (I’m thinking of mix-ins), the single chapter on Objective-C was sufficient for me to grasp the major components of the language. I assume when I’m done with the book I’ll be comfortable with Obj-C’s idioms and familiar with Cocoa. However, my advice to people interested in learning Obj-C or Cocoa is to wait for the 3rd Edition of the Hillegass book.

First, there are several places where the page layout is off. For example, between pages 69-70 several paragraphs are lost. But don’t worry, between pages 71-72 you get a whole paragraph repeated! It’s not a huge deal, but it is annoying.

More importantly, the 2nd Edition is written for Xcode 2. Unfortunately, Xcode 3 is very different from Xcode 2, so many of Hillegass’ screenshots and instructions for using Interface Builder aren’t even close to accurate. The “Hello World” application from the first chapter can’t be constructed. I was more than happy to try slogging my way through anyway, attempting to convert the book’s instructions into Xcode 3 operations, but it was all too new to me. Fortunately, Matt Long has an excellent tutorial filled in the gaps sufficiently for me to progress further. However Matt Long’s solution involved writing the necessary Obj-C class by hand, so I had to read Hillegass’ introduction to Obj-C before things clicked.

I’m now a quarter of the way through the book and I’m really enjoying Obj-C and Cocoa. Writing applications for the iPhone is going to be a lot of fun.


Written by dlkinney

March 10, 2008 at 9:25 am