[Malvern] Programming languages.

chris procter chris-procter at talk21.com
Thu Apr 28 16:05:10 BST 2005


> It appeals to me in an off-the-wall kind of way. I'm
> curious to see how 
> Objective C works compared to C and C++. And why C++
> took off whereas 
> Objective C didn't.

Objective-C did take off, you were just looking in the
wrong direction :-)

NeXT wrote a lot of their NeXTStep operating system in
it which is the basis of Apple's OSX, if you want to
do serious development work on the mac Objective-C is
the way to go.

I guess it didn't take over the world for the same
reasons Lisp hasn't, it has lots of cool tricks but in
the real world performance and installed base is far
more important. C and C++ had unix, microsoft etc,
objective-c had NeXT (everybody saying "who?" at this
point proves the point :-). Plus the syntax looks
weird if you come from a C background.

Objective-C produces slower code then C or C++ because
it does more stuff at runtime. When you call a method
on an object like
[myObject aMethod: anArg]
Objective-c doesn't work out exactly which bit of code
this runs untill it trys to execute it whereas C++
would determine the equivalent myObject.aMethod(anArg)
when it compiles it. This means its slower but it also
means you get to do funky things like decide which
method to run depending on user input kind of like:
[myObject [stdin readline]]
You can also define a default method to use if the
users input is gibberish.

There are other tricks as well, but thats my
favourite.

Gcc has pretty decent objective-c support (helped by
Apple using it as their development platform of
choice), and www.gnustep.org has a pretty complete set
of librarys etc for it and pointers to tutorials etc.

chris

Send instant messages to your online friends http://uk.messenger.yahoo.com 



More information about the Malvern mailing list