Objective C?

Status
Not open for further replies.

_klamath_

Ars Scholae Palatinae
770
Does anyone know Objective C? What do you think of it? Better or worse than C++? What is performance like?

I'm considering learning it. OSX's Cocoa looks interesting, as does the potential for an OO language that is similar to C (e.g. compiled, fast), but without C++'s complexities.

I'd be interested in anyone's comments on it, positive or negative. tia
 
I think I once worked on a project with objective C in school. (My classmate was a NeXT weenie). My memory is that it is more like Smalltalk than C++ is, but that isn't necisarily a good thing. I think (but am very much not sure) that Obj-C has a single rooted class heirarchy, which I don't personaly care for. As far as language features go, I'm sure C++ has far surpassed Obj-C now that it has templates and the STL. I don't think there were differences between the two languages that were so huge. But the real difference between the two languages are going to be the libraries. Obj-C's libraries are sure to be nicely snugly fit in with OSX's features, which could make it a more useful language for programming in that environment, though it could be that their C++ SDK is just as good.

Hmmm, I hope that was a vague and uninformitive enough reply for you.
 

jennyw

Ars Scholae Palatinae
920
obj-C is probably the language that Java borrowed the most from. It gave Java the concept of interfaces, and the syntax is probably closer than, say, C++.

Yes, Obj-C is kind of like a hybrid between Smalltalk and C. Single-inheritance and dynamic binding are touted as features, not limitations (there is a lot of debate about this). Back in the NeXTStep days, dynamic binding especially was a marketing poin.

It does not, however, have garbage collection (the only compiled language I can think of off the top of my head that has garbage collection is Eiffel).

Jen
 
Originally posted by jennyw:
It does not, however, have garbage collection (the only compiled language I can think of off the top of my head that has garbage collection is Eiffel).
CaML, SML-NJ, Common Lisp, Haskell. All are compiled, all have GC.

EDIT: Oh yeah, there's one more compiled language that, although I wish I could forget it forever, is garbage collected. Begins with a "J". Maybe some of you have heard of it.

Peace,
(jfb)

[This message was edited by nosferatu-man on December 14, 2001 at 12:50.]
 
Before the Java craze I was an Objective C developer. It was and still is used in WebObjects which uses many of the frameworks that cocoa uses. I haven't dicked around much with the developer tools at home, I stare at project builder all day at work.

Anyway, Objective-C is good for getting a lot done with a little code. Some people can't handle the [myObject release] memory management and of course it is very OO centric. You can use any C you know the book I most often consulted when I was writing Objective C was "The C Programming Language". Of course there aren't many books on Objective C.

Some of the classes were really well implemented and the API's are more consistant in naming patterns and behaviour then Java. We still use the same librairies in Java such as NSArray. It's definitely faster then Java. And one random thing you can override static/class methods in Objective C in a subclass you can't in Java, this came up in one of our most recent Java bitching sessions, I seem to recall.

Cheers,

Muskie
 
Originally posted by jennyw:
Yeah, and you can call p-code compilers compiled, too, and Python and Perl could be considered compiled languages. But most people wouldn't think so.
Neither Perl nor Python are compiled, as the interpreter has to reanalyze the source every time a program is run. Java (and p-code, for that matter) undergo this transformation and analysis phase once. Hence, they're compiled.

Peace,
(jfb)
 
D

Deleted member 5324

Guest
Originally posted by nosferatu-man:
Neither Perl nor Python are compiled, as the interpreter has to reanalyze the source every time a program is run. Java (and p-code, for that matter) undergo this transformation and analysis phase once. Hence, they're compiled.

Python caches the compiled bytecodes of a file in .pyc files when it's imported.

And (this isn't for you, nosferatu-man, but for jennyw) Java can be compiled to native code, not just bytecode.

And SML-NJ, O'Caml, and Haskell have no VM whatsoever when compiled to native code and are still garbage collected. Also note that garbage collectors for C exist (the web browser I use, w3m, uses one.)

Jeremy
 

jennyw

Ars Scholae Palatinae
920
My point was that the Java VM handles some essential things, like garbage collection. Would you consider Smalltalk to be a compiled language as well?

As someone pointed out Python does generate byte code; also Perl 6 will have a bytecode compiler as well.

I have heard of some Java compilers, but I was under the impression they accomplished this by not quite being exactly the same as what Sun spec'ed. Anyone have experience with this? It's quite possible I'm wrong.

Jen
 

_klamath_

Ars Scholae Palatinae
770
Wasn't there a big deal a few years back made about JIT (Just In Time) compilation...

That's a part of the runtime system (the VM), not the compiler proper (the compiler produces bytecode from source code; the JIT compiler produces native code from bytecode).

As someone pointed out Python does generate byte code; also Perl 6 will have a bytecode compiler as well.

Perl 5 also compiles the code internally into byte code.

I have heard of some Java compilers, but I was under the impression they accomplished this by not quite being exactly the same as what Sun spec'ed. Anyone have experience with this? It's quite possible I'm wrong.

You're mistaken. Check out GCJ, which is part of GNU's GCC (the version bundled with 3.0.x is really sweet). There are also a number of commercial native code compilers.
 

gaffa

Well-known member
6,210
I like Objective-C. the syntax is clearer, and more logical in my opinion. Other advantages of Objective-C are:

Polymorphism
Dynamic Binding
Dynamic Typing
Introspection

I think I once worked on a project with objective C in school. (My classmate was a NeXT weenie). My memory is that it is more like Smalltalk than C++ is, but that isn't necisarily a good thing. I think (but am very much not sure) that Obj-C has a single rooted class heirarchy, which I don't personaly care for. As far as language features go, I'm sure C++ has far surpassed Obj-C now that it has templates and the STL. I don't think there were differences between the two languages that were so huge. But the real difference between the two languages are going to be the libraries. Obj-C's libraries are sure to be nicely snugly fit in with OSX's features, which could make it a more useful language for programming in that environment, though it could be that their C++ SDK is just as good.

Being more like Smalltalk than C++ isn't a bad thing.
Objective-C is not a single rooted class heirarchy.
C++ has far surpassed Obj-C, yeah, right.

Cheers

Gaffa.
 
D

Deleted member 5324

Guest
Originally posted by jennyw:
As someone pointed out Python does generate byte code; also Perl 6 will have a bytecode compiler as well.

I was pointing out that Python caches compiled bytecode; as _klamath_ noted, Perl generates the bytecode too, it simply doesn't cache it.

The interesting thing about the Perl6 bytecode, btw, is that it's going to use the same bytecodes and VM as Python's (that backend being dubbed "Parrot" as a parody on Python's April Fool's joke this year.) The reason I say "Perl is going to use Python's VM and bytecodes" instead of vice-versa is that while there will be modifications in the bytecodes and VM of Python, Perl will be doing far more -- it uses a register-based rather than stack-based VM at the moment, and will be converting to Python's stack-based VM.

Jeremy
 

sittidae

Ars Centurion
325
Subscriptor
I was pointing out that Python caches compiled bytecode; as _klamath_ noted, Perl generates the bytecode too, it simply doesn't cache it.

Yes it does. The script is first compiled and then the bytecode is executed inside the Perl virtual machine.

The April Fools joke was actually posted by a Perl programmer (see http://www.perl.com/pub/a/2001/04/01/parrot.htm for the original announcement). When the Perl 6 project got underway a name was needed for the bytecode that would be generated. It was decided to use Parrot in reference to the joke. As far as I know, most of the work on Parrot itself has been done by the Perl 6 team (http://www.perl.com/pub/a/2001/09/18/parrot.html)
 
Status
Not open for further replies.