Slashdot Mirror


What Did Objective-C Do Wrong?

Dixie_Flatline asks: "Okay, I really don't understand it. I've looked at C++ and C# and I don't understand what ObjC must have done wrong to be losing out to the likes of them. It's got only a few syntax additions to C, but is actually fully object oriented, unlike C++. My only hope for ObjC right now are the GNUstep project (which really isn't high profile enough) and MacOS X (which is fine with me...it's like having my NeXT resurrected). But why hasn't ObjC just caught on on its own?"

1 of 15 comments (clear)

  1. Several Problems by Matts · · Score: 5
    First of all, ObjC started out just on NeXT. That made it fairly niche stuff, as you wouldn't find any hobbyists or Universities developing on that platform due to the expense of it. And you didn't find it running on probably 99% of the general computers out there, like Windows machines or other Unix machines.

    The second thing was that despite the ease of development, ObjC was slower than C++ at the time. C++ used a vtable for method dispatch (static dispatch), whereas ObjectiveC was a truly dynamic dispatch system, which while being a better design overall, raised a lot of criticism that meant that a number of people didn't take up the usage of the language because of non-investigative bias (i.e. hearing this in a newsgroup post and basing everything on it). Nowadays ObjC has method dispatch caching code that makes it almost as fast as C++ vtables.

    Another point is the lack of compilers. And not just free compilers either.

    Then there's the runtime library issue: C++ programs link to static programs that don't require anything extra. ObjC programs require a runtime Objective C library (at least they did last time I looked at ObjC). This is offputting if the OS you are shipping for doesn't come with that by default. Note that this is not disastrous so don't flame me on it - its just something I've been told about that people have issues with.

    Finally there's the strange syntax, which doesn't really follow C-like calling convention. It's [Object method:param namedparam2:param2value] is unlike anything anyone has seen in C before, whereas C++ at least was mostly just an extension of the struct idea. Of course you could go on arguing about this forever, such as the fact that Objective C is easier to debug because you can see what are method calls very clearly due to the syntax, and the named params are better. But all that is history now. People don't like to change the way they work, thats why Perl appeals to both C programmers and shell programmers alike - because the cognitive dissonance is low.

    Anyway, I hope that helps.

    For more information on Objective C, apple provides free Objective C documentation (which I believe is based the original NeXT docs) at http://developer.apple.com/techpubs/macosx/System/ Documentation/Developer /Cocoa/ObjectiveC/ObjC.pdf.

    --

    Matt. Want XML + Apache + Stylesheets? Get AxKit.