• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why Cocoa-java?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why Cocoa-java?


  • Subject: Re: Why Cocoa-java?
  • From: Andy Lee <email@hidden>
  • Date: Mon, 22 Apr 2002 00:22:52 -0400

At 8:45 PM -0700 4/21/02, praveena tandon wrote:
Hi all,
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.

The way I see it, it's not so much about authoring native *binary* programs. It's more about authoring true *Cocoa* programs -- programs that use the native OS X widgets and interact correctly with OS X, via AppleScript, Services, and what have you. The Java Cocoa bindings let Java programmers be productive with Cocoa sooner than if they had to learn Objective-C.

But 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 would guess that lightweight JNI wrappers around Objective-C libraries would run faster than a pure Java version of the same app. Maybe not as fast as a totally native Cocoa app, but that's the price one pays for the luxury of using Java if that's what one prefers.

Is there is any distinct advantage when using
cocoa -java applicaion. If I am a skilled Java
programmer, why would I not just write my program
using whatever version of the JDK makes sense?

Swing components are sluggish, and they do not support some OS X ways of doing things. That's the price one pays for write-once/run-anywhere. If WORA is extremely important -- more important than being a perfect OS X citizen -- okay, it might make sense to go with a pure Java app. But if you seriously aim to please an OS X audience, then stick with Cocoa -- ideally using Objective-C, but Java should work too.

I
already know the APIs / frameworks available to me -
why learn something new that isn't portable.

Of course it's up to you, but I wouldn't want to use portability as the only criterion for deciding what to study. Maybe you want to accomplish things that are only possible with Cocoa (like deliver maximum-quality OS X applications). Or maybe Cocoa is just fun. Or maybe you believe future programming environments will resemble Cocoa, so although the language and libraries may not be portable, the concepts will.

--Andy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Why Cocoa-java?
      • From: Ondra Cada <email@hidden>
    • Re: Why Cocoa-java?
      • From: Andy Lee <email@hidden>
References: 
 >Why Cocoa-java? (From: praveena tandon <email@hidden>)

  • Prev by Date: Why Cocoa-java?
  • Next by Date: Re: Why Cocoa-java?
  • Previous by thread: Why Cocoa-java?
  • Next by thread: Re: Why Cocoa-java?
  • Index(es):
    • Date
    • Thread