Why use "Cocoa Java"? Why not just plain old "Cocoa" or JDK 1.whatever and Swing?
Date:
2001-10-01 10:35:39
From:
smithkennedy
This is not meant to antagonize anybody. I am genuinely curious. I don't undestand why somebody would want to do this.
I had originally thought that the Java Cocoa bindings were created by Apple to allow Java or C++ programmers to more easily author native binary programs using the Cocoa framework, but allow them to leverage their familiarity with Java/C++ syntax. But from what I understood from talking with people at WWDC, a program written in Java using the Cocoa APIs does not compile into a native binary. Instead, it compiles into the usual Java bytecodes. The Cocoa Java bindings are simply JNI interfaces into the Cocoa framework. But this program has been written using a platform-dependent Java API, which means it isn't portable to other platforms. So you end up with a program that is tied to one platform, but doesn't execute natively on that platform.
I fail to see any advantage to writing a program in this way. If I am a skilled Java programmer, why would I not just write my program using whatever version of the JDK makes sense? I already know the APIs / frameworks available to me - why learn something new that isn't portable. And, alternatively, if I am willing and able to learn Objective-C, why wouldn't I learn the Cocoa framework using the language it was originally implemented in?
As I said, I am not trying to kick sand in anybody's eyes here. I just have never heard anybody demonstrate why this would be a good engineering decision. I come from a background of 5 years of Java development experience, and I have recently been trying to address what framework I should learn to develop UI on Mac OS X. Code portability is definitely important.
Thanks for any info.
Showing messages 1 through 4 of 4.
Why use "Cocoa Java"? Why not just plain old "Cocoa" or JDK 1.whatever and Swing?
2003-12-05 01:07:30
maerics
[View]
Interface Builder. In half an hour you can create a polished, intuitive GUI that plugs right in to your code. And, if you use the MVC paradigm well you can reuse the model objects and just write new controllers for, say, a pure java GUI.
But I've got to agree with you. JNI is "Java" only in language, not in portability. So the only real reason to use Cocoa java is because you want to write a serious application for Mac OS X and are more comfortable with Java than with Objective-C. But of course, that's not so strong a justification until Apple comes up with JNI wrappers for all of the frameworks (Security I'm looking at you).
-mike
Why use "Cocoa Java"? Why not just plain old "Cocoa" or JDK 1.whatever and Swing?
2002-06-04 21:58:54
kastork
[View]
I think Apple developed this whole system to enable the use of Interface Builder. Goal being -- make it easy to make Mac OSX programs using Java, as opposed to making Java programs that happen to run nice on OSX.
I use Swing.
2001-10-04 12:27:36
gagganator
[View]
I think you are absolutely right. Java Cocoa is probably faster than Java Swing but slower than Obj-C. Probably Java Cocoa is an easier way to speed a Java program than rewriting in C; however with accelerated Swing the gap will close.
RE: Why use "Cocoa Java"? Why not just plain old "Cocoa" or JDK 1.whatever and Swing?
2001-10-01 10:37:10
smithkennedy
[View]
But I've got to agree with you. JNI is "Java" only in language, not in portability. So the only real reason to use Cocoa java is because you want to write a serious application for Mac OS X and are more comfortable with Java than with Objective-C. But of course, that's not so strong a justification until Apple comes up with JNI wrappers for all of the frameworks (Security I'm looking at you).
-mike