Friday, January 04, 2013

Learning Objective C: First takes

Having gotten the new Macbook Air, I'm deep into learning Objective C and the Cocoa framework. I'll probably have more to say later, but here some initial impressions.

First off, the Objective-C syntax will baffle and confuse you - until it won't. As a relatively experienced developer who has worked in C/C++ for years, and also worked with C#, VB, SQL, PHP, Javascript and even a bit of machine code (back on a 6502), the Objective C syntax is nothing like I've ever seen before. Something even as simple as declaring a class method with 2 parameters took some getting used to, and I really had to practice a bit before I got the hang of it.

The good news is that once you get used to the syntax, the ideas are familiar and elegant. Object oriented code, familiar C constructs, inheritance, polymorphism, its all here and implemented rather well.

Moral of the story ? Don't let the syntax scare you. Persevere. And if you are an experienced programmer you will start to feel at home in about a week.

In terms of learning resources, I've been looking all over the web and online bookstores, and the two books I've found to be really good so far are:

I'd advice to start with the Objective-C book, get a hang of the basic language constructs, and then dive into Cocoa - which is in essence the API (the rough equivalent of win32 for old windows coders)

Both are well written but the Objective C book is specially good. If you know C/C++ you will be able to skip/browse some of the chapters, but it explains everything in a nice conversational style.

Another good resource for experienced C/C++ programmers is: From C++ to Objective-C version 2.1 by Pierre Chatelier. This is not so much a tutorial but a very nicely written document to quickly on-ramp you to the Objective-C syntax. As the title suggests, it is aimed at experienced C++ developers, if you fall into that category, I would highly recommend a breeze thru it even if you don't read it cover to cover. It contains side-by-side comparisons of Objective C and C++ syntax which is very useful.

I'm still getting started in the world of Objective C, so more later

No comments:

Post a Comment