by praptak · 15y ago · 0 comments
Reason 1: When you need what C provides, it is right there for you (being a superset of C)
Reason 2: When you need what C does not provide (basic reflection, generics, polymorphism, whatever) it is in the "bracket" part of Objective-C.
Reason 3: The two above do work quite well together - the impedance mismatch is minimal, compared to e.g. Python with extensions written in C.
This is where I get to promote my favorite page of documentation ever: http://developer.apple.com/library/mac/#documentation/Cocoa/...
This actually makes me wonder... how much overhead is in each objective c object over a similar struct in c?
But, it's fast enough for 95% of things people do with it.
http://mikeash.com/pyblog/performance-comparisons-of-common-...
And that's from 2008. Clang's improved it a lot.
The fact that Obj-C takes C and adds objects on top is its biggest flaw, just like with C++. Worse than C++ though, Obj-C doesn't even attempt to fix at least some of C's more glaring flaws... you get the whole language, quirks and all.
Not even Java's fans would defend it as a "well thought out OO" language.
Since this is Hacker News, it maybe appropriate to point out that nothing prevents you from building whatever specific flavour of OO you want on top of the Objective C runtime, if you want it badly enough.