Friday, February 26, 2010

Objective C

I've been reading a document written to help C++ programmers learn Objective C. If you are in my situation where you know C++, but Objective C seems completely unreadable, then I suggest you read it too. It's very good and hits on all the main points you need to know.
Objective C isn't actually a very large language, being a strict superset of C, but has some very nice features. The main difference is that instead of calling methods on objects, you send messages to them instead. So in effect, if an object doesn't implement the method you want to call, then you get an exception, rather than a crash in C++ (after convincing the C++ compiler to let you do it...).
Classes are also treated as objects, so you can query classes for properties and so on. All in all, this makes for a more object oriented language, although presumably wouldn't have the efficiency of code written in C++ or C. The Objective C memory model seems pleasant to get along with, and then you could just rely on a garbage collector as well if you don't even want to think about it.
Now, to actually try some exanples using it.

No comments: