The Objective-C Learning Curve

Apple have done a great job in providing developers with source code for a range of sample iPhone applications. And due to this I was able to quickly knock up a couple of fairly simple test applications of my own. This of course was very gratifying and led me to the impression that it would be possible to produce a more complex and polished application within a couple of weeks.

However, despite this initial experience, and having also had some previous experience of C (having written several Windows C DLLs), I have now decided that learning Objective-C and the Touch Cocoa framework for iPhone development is going to be considerably more difficult than I first thought.

Part of the problem is due to the C language itself. This is, of course, somewhat notorious for allowing (and even encouraging) terse code, and rather minor and subtle variations in syntax that are hard to spot at first glance can create difficult-to-trace bugs.

Another issue is the richness and depth of the Cocoa framework. It seems there is hardly any need to write raw C code at all. Almost every imaginable function, operation, conversion you might need is taken care of within the framework. If you are already familiar with this framework (for example by having previously programmed for Mac OS-X) then you will have an excellent heads up here. But for the newcomers like myself, the combination of lack of familiarity with the framework alongside the C language subtleties can make for rather tough and slow progress.

All this does not necessarily make for any more of a challenge than does attempting to pick up any new development environment, tools and language. However, there is a third issue which, in combination with the other two, make things pretty challenging all round. That issue is the limited availability of on-line samples, discussions and forums ie. the lack of any easily-accessible community and knowledge-base. Apple has not helped here at all by ensuring developers sign an NDA which is a strong disincentive to share your own knowledge, experiences and examples.

A (very) rough illustration of what I mean here is to compare the Google search results of, say some PHP function names versus those of some Cocoa framework classes.

  • “PHP mysql_query” – 3,800,000 pages
  • “PHP XPath” – 409,000 pages
  • “PHP curl_init” – 119,000 pages
  • “Cocoa NSDictionary” – 43,100 pages
  • “Cocoa NSURLRequest” – 4,280 pages
  • “Cocoa UITableView” – 2,130 pages

I don’t know quite how typical I am here, but I suspect I am not alone in using web search heavily when learning new progamming languages and environments, and the sparsity of publicly available pool of knowledge and expertise is a real obstacle in getting up to speed in the first place, and subsequently (even more importantly in my opinion) acquiring the extra tips, skills and knowledge needed to produce polished, high quality applications.

All I can do for now is to plead with Apple to

  1. drop the developer NDA agreements (at least for current and past releases of their SDK)
  2. actively encourage developers to share their knowledge and experience

Its hard to imagine how the effect of this on Apple could be anything other than highly beneficial, and it would certainly increase the quality and depth of applications for the iPhone in general.

Oh… And it might also help me get over this aching brain sensation I’ve had for the last few days!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s