Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC vs Java -- NEWBIE



Lotsa Cabo wrote:
| 1. If I code my Cocoa app using Java, how much slower than Objective-C
| will Java be?

Only measurement will tell. It depends greatly on whether you're measuring, say, elapsed clock time as the user sees it, actual consumed CPU time (ignoring time used by other applications), or some other measure. It will depend on the execution pattern of your program: something the just-in-time compiler can sink its teeth into will suffer much less of an interpretation penalty.
*In theory*, the Java program will be slower, because the interpretation of the byte codes requires executing more instructions per source operation. In practice, there are a variety of tricks that can be used to keep the etxra instructions to a bare minimum.


| 2. For the .NET WebService access, which is better, Java or ObjC?

Neither one has any .NET support at all.


| 3. For XML parsing, which is better, Java or ObjC?

XML parsing is done by libraries, so the question is properly, what's the best library, and what language does it require I use? (If you've already chosen a language, the proper question is, what's the best library for this language?)


| 4. Each time I have installed an app on my new PowerBook, I've had to
| copy one object (I think it's a "bundle") from a drive image to my
| Applications directory. I think this is a great install process. If I
| code my app using Java, will I be able to use this type of install
| method when my app is distributed?

If you want the *same* package to run on all platforms, then you'll need to insure that everything the program needs can be put into *one* jar file. Both the Mac and Windows support running Java programs directly from jar files.

If you have things that can't go into the application jar file (XML parser libraries, for example), then you'll need to use either a platform-specific package (assuming Windows has such a thing) or an installer.


| 5. Java apps on Windows are ugly. If I code my app in Java, will the
| user know that it's Java when it's running?

The user generally has no idea what language was used to write a program. He rarely cares, either. He sees only "well done" or "badly done". And that's determined not by language, but by how easy the program is to use and how closely it hews to the platforms' UI guidelines.

For the Mac, the question isn't "Java vs. Objective-C" but "Swing vs. Cocoa". Swing doesn't do Aqua well, so a Swing-based program requires code that a Cocoa-based program wouldn't, both to force Swing to do the right thing, and to implement behavior that Swing doesn't provide (sheets, for example). Objective-C has the advantage here simply because Java's Cocoa lags behind Objective-C's Cocoa in features.

As Swing was modelled on the Windows UI, there's a much better fit there.


| 6. The few lines of Objective-C that I have seen has no resemblance to
| any language that I'm familiar with.

Objective-C is simply C with a little extra syntax thrown in. (This is why "Objective-C++" can exist--it's C++ with the same extra syntax thrown in.) The extra features are needed to accomodate Objective-C's implementation of classes. The least-familiar syntax would be the method calls, e.g., "[target moveThis: thing toThere: location]", which has as its Java equivalent, "target.moveThisToThere(thing, location).


| Considering I will be developing on a Mac and M$ platform for years, is
| there any major benefit to learning Objective-C?

Aside from broadening your understanding of the ways of programming? Only you can say.


| In short, I'm trying to figure out which language to use.

Do remember that the choice isn't simply "Java vs. Objective-C". There *are* other languages you can choose from, ones which support cross-platform UI construction. One of those might be your best choice.

Also, your questions suggest that you're not making the very important distinction between *language* and *libraries*. Most of your questions aren't about the languages themselves, but about what libraries are available for each language. (Objective-C isn't Cocoa, and Java isn't Swing.) The Java libraries will tend to be the same on all platforms, because Sun supplies them. Objective-C libraries will be less dependable, because Apple supplies Cocoa only for the Mac; if you need it for some other platform, you'll have to look elsewhere. If that's a concern, then you have to figure that into your decision.

Glen Fisher
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.

References: 
 >ObjC vs Java -- NEWBIE (From: Lotsa Cabo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.