• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Comparisons to Java?

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 1246
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.


 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Billy Hause
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic