wood burning stoves 2.0*
The moose likes iOS and the fly likes Comparisons to Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » iOS
Bookmark "Comparisons to Java?" Watch "Comparisons to Java?" New topic
Author

Comparisons to Java?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61646
    
  67

Given that the vast majority of members to these forums have a strong Java background, does the book have any comparison to Java? Other languages?

Or does it introduce Objective-C on its own merits without other-language comparisons?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Or, can you even compare Objective-C for IOS to Java?

From what I've seen, most IOS developers don't do much creative within Objective-C the language, whereas most programmers here on the Ranch, and most Java programmer, do a lot more with Java itself.
nik gen
Greenhorn

Joined: Mar 24, 2008
Posts: 12
Hi,

There are many differences between java and Objective-C. Few of them are as below.

1. Java has Garbage Collection, Memory is handled by developer in Objective-C.
2. Java has static typing, where as Objective-C has dynamic.
3. Objective-C has rich API to develop GUI comparatively Java.

Apart from this, there are some pros and cons for each language.

Pros of Java:
1. Platform Independent.
2. Availability of many third party libraries.
3. No header files or function prototypes.
4. Direct access of member variables.

Pros of Objective-C:
1. Categories.
2. Use standard C code natively.

Cons of Java:
1. Performance cost of the brifge. JavaBridge, XcodeObjCJavaBridge.
2. Performance cost of the Virtual Machine.
3. lots and lots use of memory.

Cons of Objective-C:
1. Need to handle memory management explicitly.
2. Not as many as resource available.
3. Objective C is somewhat slower than Java. But the fact is Cocoa-Java is slower than Cocoa-Objective-C. also pure java is faster.

Thanks,
Niketa.






Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

nik gen wrote:
Cons of Java:
2. Performance cost of the Virtual Machine.
3. lots and lots use of memory.


I don't know where you are getting this. The JVM has amazingly good performance, the GIT is wonderful. Together, they let Java run as fast as typical C programs. Sure, the best C programs are better, but most C programmers are not that good, and their code is not that great.

Similarly, I don't see any grounding for your "lots and lots of memory" claim.

In the context of Objective-C for IOS, Java has a huge "con" in that there are not the wonderful IOS frameworks, so you would have to write native Java GUI code, which can't take advantage of the cool new IOS features, look and feel, etc. But that is not really a problem/issue with Java as much as its a side effect of Apple's policy to push you to Objective-C.

Apple does not want us to develop code in a cross platform environment. So we can't.
Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1242
nik gen wrote:Hi,

There are many differences between java and Objective-C. Few of them are as below.

1. Java has Garbage Collection, Memory is handled by developer in Objective-C.
2. Java has static typing, where as Objective-C has dynamic.
3. Objective-C has rich API to develop GUI comparatively Java.

Apart from this, there are some pros and cons for each language.

Pros of Java:
1. Platform Independent.
2. Availability of many third party libraries.
3. No header files or function prototypes.
4. Direct access of member variables.

Pros of Objective-C:
1. Categories.
2. Use standard C code natively.

Cons of Java:
1. Performance cost of the brifge. JavaBridge, XcodeObjCJavaBridge.
2. Performance cost of the Virtual Machine.
3. lots and lots use of memory.

Cons of Objective-C:
1. Need to handle memory management explicitly.
2. Not as many as resource available.
3. Objective C is somewhat slower than Java. But the fact is Cocoa-Java is slower than Cocoa-Objective-C. also pure java is faster.

Thanks,
Niketa.



Obj-C has Garbage Collection but it is turned off on iOS for performance reason, hardware constrains.
Objective C is somewhat slower than Java? really? do you have more info on it?
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

You don't have to manually manage the memory in Objective-C. Objective-C has two modes: manual managing (iOS case) or garbage collected (right now on OS X).
How could be having header files, function prototypes and not having a direct access to member variables cons for Objective-C?
Billy Hause
Greenhorn

Joined: Jan 16, 2002
Posts: 25
nik gen wrote:Hi,

There are many differences between java and Objective-C. Few of them are as below.

1. Java has Garbage Collection, Memory is handled by developer in Objective-C.
2. Java has static typing, where as Objective-C has dynamic.
3. Objective-C has rich API to develop GUI comparatively Java.

Apart from this, there are some pros and cons for each language.

Pros of Java:
1. Platform Independent.
2. Availability of many third party libraries.
3. No header files or function prototypes.
4. Direct access of member variables.

Pros of Objective-C:
1. Categories.
2. Use standard C code natively.

Cons of Java:
1. Performance cost of the brifge. JavaBridge, XcodeObjCJavaBridge.
2. Performance cost of the Virtual Machine.
3. lots and lots use of memory.

Cons of Objective-C:
1. Need to handle memory management explicitly.
2. Not as many as resource available.
3. Objective C is somewhat slower than Java. But the fact is Cocoa-Java is slower than Cocoa-Objective-C. also pure java is faster.

Thanks,
Niketa.



"Objective C is somewhat slower than Java."
Is that a typo?
The best Java could hope for is to be slightly slower than the native equivalent.

In my tests between Java and C++ using a standard sorting algorithm to sort a random list. I've found Java to be 5 to 10 times slower than C++. I can only guess the same would be true for Java vs. Objective C.


Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Billy Hause wrote:
n my tests between Java and C++ using a standard sorting algorithm to sort a random list. I've found Java to be 5 to 10 times slower than C++.


That was a very flawed benchmark, then. People have done these sorts of tests for years, and if you compare a number of different C++ compilers and a number of different Java runtimes, you find that the difference isn't anywhere near that large: when the tests are done properly, the best C++ and the best Java results are always within a factor of 2 of each other. In general, the very best C++ compilers do win -- as they do here, for example -- but the common compilers like g++ and (cough) Visual C++ are not the best compilers. A good JVM often outperforms C++ code compiled with these less-than-ideal compilers.


[Jess in Action][AskingGoodQuestions]
Billy Hause
Greenhorn

Joined: Jan 16, 2002
Posts: 25
Ernest Friedman-Hill wrote:
Billy Hause wrote:
n my tests between Java and C++ using a standard sorting algorithm to sort a random list. I've found Java to be 5 to 10 times slower than C++.


That was a very flawed benchmark, then. People have done these sorts of tests for years, and if you compare a number of different C++ compilers and a number of different Java runtimes, you find that the difference isn't anywhere near that large: when the tests are done properly, the best C++ and the best Java results are always within a factor of 2 of each other. In general, the very best C++ compilers do win -- as they do here, for example -- but the common compilers like g++ and (cough) Visual C++ are not the best compilers. A good JVM often outperforms C++ code compiled with these less-than-ideal compilers.


With all due respect, that sounds like wishful thinking to me. Java is a great language but it's not very fast compared to a compiled language like C, C++ or Objective C.
Here is a link to benchmarks performed and published by Google. http://www.readwriteweb.com/hack/2011/06/cpp-go-java-scala-performance-benchmark.php
It's just common sense that any language that runs in a VM (JIT or not) will not be any where near as fast as the native equivalent.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Comparisons to Java?