Taking up Objective C

Apr 26, 2011

So, to learn new stuff, take over the world, and pad out my resume in the process, I decided to write a module for Titanium Mobile that would allow developers to access the Stackapps API.

Created a repo on Github, created skeleton modules for iphone and android, committed the same to the repo, and then tried going through the iOS documentation provided by the helpful folks at Appcelerator. Of course, I was vain enough to believe that I would be able to pick up Objective C as I went along, but reading that documentation proved otherwise. After reading about implementing interfaces, -(id) methods and “protocols”, I decided that perhaps I might have to have a quick look at a primer on Objective C.

Read “Learning Objective-C: A primer” on Apple’s developer site. And man, maybe I’ll get the whole “oh, so THAT’s why Apple has designed the language this way!” revelation in a couple of weeks, but right now the language looks pretty damn weird. It looks like Apple went out of its way just to make sure the language doesn’t look OR sound like any of the popular languages (that I’ve used, might be what lisp looks like though, given all the braces).

For example:

(void)insertObject:(id)anObject atIndex:(NSUInteger)index;
[myArray insertObject:anObject atIndex:0];
[[myObject theArray] insertObject:[myObject objectToInsert] atIndex:0];

I mean, seriously, WTF?!