Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any huge differences between objective-c and Java, or iPhone and Android?

Edit: My bad, I meant objective-c, not c#. Some reason I got it into my head it was c# the iphone used. So the answers for c# were great, thanks, but theyre a bit irrelevant, sorry about that.

I've had a look but can't find anything that answers this, though a few have shortened the question by answering parts of it. Between a small group, we were planning on doing some work on iPhone and Android, the 2 seperate for the most part but helping each other out, and with some guys doing graphics work split between them.

But we were thinking about the possibilities of moving things between the two, not necessarily apps, maybe just useful classes or something. Looking at objective-c and Java, they seem to have about the same features that the biggest obstacle would be system interface stuff, so we were wondering whether, if we created an abstraction over these on each system so they could be given the same input (which unless I'm wrong wouldn't put too much strain on the system?), would there be any problems in writing something to convert between objective-c and Java, worse than the locations of methods in the sdks? Or are there key features or something in one language that the other doesn't have which we've missed that would mean the only way to do it would be rewriting from scratch.

like image 535
AaronM Avatar asked Jul 24 '10 17:07

AaronM


People also ask

Can Objective-C be used for Android?

In addition to the compiler you'll also need the Objective-C runtime, which exists open-source as libobjc2 and works on Android. With this, and using GNUstep as an implementation of the Objective-C frameworks (i.e. Foundation) you can absolutely use Objective-C code on Android.

Is Objective-C only for iOS?

Objective-C programs developed for non-Apple operating systems or that are not dependent on Apple's APIs may also be compiled for any platform supported by GNU GCC or LLVM/Clang. Objective-C source code 'messaging/implementation' program files usually have .

Is Objective-C same as Java?

Objective-C is a compiled OO programming language. Java is both compiled and interpreted and therefore does not offer the same run-time performance as Objective-C. Objective-C features efficient, transparent Distributed Objects. Java features a less efficient and less transparent Remote Machine Interface.

Why is Objective-C so different?

Objective-C uses the runtime code compilation Objective-C isn't a fast language. The main reason is that it uses the runtime code compilation, rather than the compile time. This means that when the Objective-C object calls for another object in the code, there is an extra level of indirection involved.


1 Answers

I wouldn't waste time trying to find commonality between iOS and Android.

Cross-platform is almost always a waste of time and resources unless the cross-platform capability is central to the apps functioning. That is especially true for platforms such as iPhone and Android which have custom OS and work very tightly with the hardware.

Cross-platform development environments add rather than reduce complexity long term. Yeah, it sounds neat but usually you get 90% what you want easily and then you hit a roadblock that destroys all the savings you made and then starts putting you in the hole. There are simply to many compromises and square pegs jammed into round holes.

Unless your app could in theory work from a generic web page, cross-platform is not for you.

In the specific case of Objective-C and Java, although Java is descended from Objective-C they have no modern interoperability. You can't use code from one on the other.

You should spend the time to learn each platform's specific API. There are no shortcuts.

like image 109
TechZen Avatar answered Oct 21 '22 20:10

TechZen