RE: Learning Cocoa (OT!: Small Language Rant)
RE: Learning Cocoa (OT!: Small Language Rant)
- Subject: RE: Learning Cocoa (OT!: Small Language Rant)
- From: "Dennis C. De Mars" <email@hidden>
- Date: Mon, 16 Jul 2001 20:02:57 -0000
Mark Orchard <email@hidden> said:
>
Hear! Hear!
>
>
Apple (or is that Next with a peel) is publicly extolling the virtues of its
>
embrace of Java2, yet internally, and for developers, showing a preference
>
for ObjC. This old language and its archaic syntax has had its day (I don't
>
want to wear holes in my "square-bracket" keys!). I hope Apple will stay
>
true to its word and develop a FASTER VM with Java (and C++) as it's
>
preferred development language(s) (with "support" for ObjC).
Since Unix underlies OS X it is now easier to port the latest VM technology to the Mac,
which I understand is exactly what Apple is doing.
I don't know about the business of Java and C++ as the preferred development languages.
I wasn't aware of such a "promise" nor do I think it would be a good idea.
>
For those who want C++, that'll probably have to wait until Metrowerks
>
brings PowerPlant and a fast C++ compiler to OSX.
>
>
I don't usually reply to these threads but I was a little surprised when I
>
read the following -
>
>
>I think we're getting pretty off-topic for this list; there isn't
>
>usually much Cocoa-Java discussion on it anyway. You're probably
>
>better to try one of the general OS X/Cocoa developer lists, at least
>
>to get a more balanced perspective.
>
>
?!?! Cocoa-Java off-topic for the JAVA-DEV list!! There is a specific Cocoa
>
dev list but still, MRJ isn't the only "Java" going.
Since I don't subscibe to the java developer list anymore, I didn't see the orignal
whole thread, but I guess an argument could be made that the JAVA-DEV list is more
suited for discussion of developing for the Java _platform_ (i.e. writing Java code
using 100% pure Java or nearly so), whereas inquires about Cocoa, regardless of the
language, would be more suited to the Cocoa-Dev list.
>
I hope I'm not of the mark but wasn't the original poster to the JAVA-DEV
>
list a Java developer looking for help in writing Cocoa?
>
Did my eyes deceive me or did the following replies gently suggest he should
>
move to ObjC?!
>
Is it a given that if you want to develop Cocoa apps you should forget Java
>
and do ObjC?
That probably summarizes accurately some people's opinion, but not necessarily Apple's
(hopefully not Apple's).
Personally, I was looking at the question of what language to use over a year ago, from
the position of knowing Java and not knowing Obj-C. I decided in favor of Obj-C in part
because I wanted to write widely-distributed commercial programs, whereas I think Java
is more suited to in-house development (and I have advocated it for such) especially
where you also want to maintain platform independence. If you are programming in Cocoa,
platform independence is not an issue.
Now, that is my own personal decision. Many Java developers will strongly disagree with
some of that. Since Apple has comitted to supporting Java for Cocoa development, I
think it is incumbent upon them to make sure it is a viable choice. I think they made a
good start, but they still have API's to finish and documentation to supply, and I
haven't seen much action lately on these items.
>
The latest VMs for Windows and other platforms have increased their speed
>
greatly. Apple is benchmarking poorly here.
>
The Java Bridge is well engineered but still overhead.
I think the faster VMs are coming. As for the Java Bridge, see below.
>
For whatever political reasons Apple has stayed with Next's ObjC as the
>
foundation for Foundation/AppKit.
[Sigh.] Look, NextStep is an object-oriented framework that is written in ObjC. When
they made that decision, Java was nonexistent and C++ was nascent. The price you pay
when you program to an OOP framework is that you are tied to the runtime of the OOP
language used to implement the framework, which effectively limits the languages you
can use. If another language has a sufficiently similar runtime method-dispatching
mechanism you might be able to interface them without too much trouble (Object Pascal
and C++ for instance, could both be used to interface with MacApp).
I don't see why this has to be laid to some bizarre political motivations. They had a
large body of code in Obj-C, the way the whole system works is largely keyed to the way
Obj-C works. What would you have them do? Rewrite it? The whole point of Cocoa was that
we were getting a great, mature OOP framework, doesn't seem too rational to rewrite it
from scratch. And what would you have them rewrite it in? Rewrite it in Java? Then the
C++ and Obj-C programemrs would be P.O.'d. Rewrite it in C++? C++ wouldn't be too
suitable, and besides the Java and Obj-C programmers would be P.O.'d. The whole idea
sounds like a non-starter to me.
>
They may rue the day. A lot of Java/C++ developers won't want to touch ObjC
>
with a 10-foot pole. I know I don't and I want to write OSX applications in
>
Java using Foundation/AppKit, not Swing.
I think it is safe to say that they anticipated the problem and that is why the Java
Bridge is there. There is some overhead, but this is inevitable if you are going try to
interface to a foreign OOP framework.
As I said before, I think Apple needs to support the Java interface to Cocoa, but let
me also say:
I don't know these "Java developers" and "C++ developers" of which you speak.
Fortunately, none of the programmers I know have their brains wired to use only one
particular computer language. Especially when adressing a large OOP framework it seems
to me only sensible to use the native language of that framework rather than complain
that all frameworks must be rewritten in my favorite language. When I want to program
Swing (and there are occasions when I want to do that) I use Java. When I want to
program Cocoa, I'll use Obj-C (even if and when the Java interface is improved).
As for the "primary programming language" of the Macintosh, fortunately there is none.
Right now you have the following choices:
Carbon: Use C or C++ (or ultimately many other choices).
Cocoa: Use Objective-C or Java (conceivably other language bridges could be created at
some point, I've seen interest in SmallTalk, Python, Dylan, etc.)
Java VM: Use Java to program Swing. (...or I guess anything else that generates the
Java VM bytecodes: JPython, etc.)
I should also point out that the Carbon interface is particularly important because a
purely procedural interface is far easier to port to other languages, so Carbon will
provide a link to language development in the future (I don't think language
development is going to end with Java, C++ and Obj-C).
Finally, I am wondering how many programmers are really not going to touch Obj-C with a
ten-foot pole. I started learning Cocoa from a pro-Java bias, and only being vaguely
familiar with Obj-C from the old days, but I eventually decided Objective C is actually
pretty cool. Have you really looked at the language? I hope most programmers interested
in Cocoa will at least give it a chance. There are definitley some useful Java features
that are missing from Obj-C, but on the other hand the "named parameters" make method
calls in Obj-C far more readable than their Java counterparts.
- Dennis D.