Re: Why Objective-C over Java?
Re: Why Objective-C over Java?
- Subject: Re: Why Objective-C over Java?
- From: email@hidden
- Date: Sat, 26 May 2001 09:37:25 -0700
>
I am a new to OS-X programming and I don't have experience with
>
Objective-C.
>
I understand that Objective-C is seemingly not hard to learn, but I want
>
to stay with Java at this stage because of compatibility and reuse
>
issue. Thus it seems to be natural for me to stick to java and jump
>
into writing for OS-X with it.
>
However I'm curious how many people have been there, and how do you
>
think about Java in OS-X and PB/IB environment. Would it be more
>
productive to start with Objective-C? Isn't there any major pitfall
>
hidden? Most people in this list seems to be working with Objective-C
>
API. Does Apple recommend Objective-C over Java? if so, what's the
>
reasoning behind this?
You might want to start to looking at the archives - this topic has been
hashed and rehashed. At some point, the discussion devolves into a more
general Java v. Objc argument, rather than a Java v. Objc for Cocoa
argument.
Here is the general gist of the argument that will likely follow. Most of
the more experienced Cocoa / NextStep developers will tell you that
Objective C is a much more elegant language. A few people will argue this
point, but the majority here think that Objective C is a superior language
(I tend to agree, but am new to Objective-C, so my opinion doesn't really
count). Many of the people who like Java will concede, however, that
programming using the Java Bridge really doesn't make much sense for
general purpose programming. Cocoa was designed from the ground up in
objective-C - using the various constructs of Objective-C that don't always
translate well to Java, which is a strongly typed language, and which lacks
many of the features of Objective-C, like categories. You also incur the
additional overhead of the JVM on top of the Objective-C runtime engine.
Now, don't get me wrong - the Java Bridge is pretty neat, and can be a
lifesaver for some purposes - especially in rapid prototyping, it enables
you to utilize functions of the Java Class Libraries. Java, being such a
vogue language, has a lot of available functionality, both officially from
Sun and from other developers. I'm amazed at how often someone has done
what I need to do already in Java - and is willing to share their code.
Java is also much easier to reverse engineer from compiled applications,
and the entire Java Class Libraries source is available, which can make it
easier to learn the ins and outs of a particular class. (Many have argued,
however, that the difference in Cocoa and Java obviates the need for this
in Cocoa).
The final thing you will see bandied about is that objective-C is really
very easy to learn. The syntax takes a few days to master, tops. What does
take a long time is learning the Cocoa libraries - but if you're
programming Java Cocoa, you still need to do this, and you'll need to do it
with less documentation.
If you plan to target Mac OS X solely or primarily, you're much better off
investing in learning Objective-C. Otherwise, you're far better off using
the Swing libraries (ew..), so that your app will be available to more than
the 5% of computer users that Macs represent.
Did I miss any of the arguments Pro or Con? I'm sure if I have, that they
will get rehashed by others. In fact, even if I don't, they will likely get
rehashed by others. This is one of the few "holy wars" on this list, but as
far as I can tell, the Java / Cocoa proponents are usually the ones who get
crucified...