Yet another reason why it was a terrible idea to base the Android SDK on Java. What WERE they thinking?
I know, let's force everyone to use a scripting language to write for underpowered phone hardware! We don't need native support! Just because Apple did the same with iPhone to start with, and it came back to haunt them later, doesn't mean that we won't get away with it! And don't forget Microsoft did the same thing with C#--look where it's gotten them! And while we're at it, let's pick a proprietary and patented language that's a laughing stock in language design circles!
I doubt this makes a dent in Android, though, and I would be amazed if this changes their Java strategy in the slightest. In a battle between Oracle and Google, I think the smart money is on Google.
Is this meant as irony? Java is not by any stretch of the imagination a scripting language (static, bytecode-distributed, etc.), Objective-C is directly translated into C before being compiled, and C#/.NET is probably one of the better things Microsoft has cooked up.
This is kind of debatable, but I'd also say that modern phones are freakishly overpowered. The ARM Cortex IP used by the current generation phones really is a slick little architecture, and can definitely handle the overhead of running bytecode.
Java is interpreted on Android on every version prior to Android 2.2. Lua (clearly a scripting language) also converts to bytecode on load, and runs faster than Java in most cases. I'm pretty sure Python also converts to bytecode.
Objective C has a lot of run time overhead due to its "message passing" paradigm. So any time you need to use a Cocoa API, it's pretty slow. Somewhere I read that, as a result of Objective C overhead, the iPhone ends up about the same speed as Android in typical apps--so that with Android 2.2 getting a JIT compiler, it ends up much faster on similar generation phones.
EDIT: I just realized what you were confused about. Originally Apple said: "NO native SDK. You must use JavaScript on web pages to create iPhone apps." That's what I meant by "Apple started with a scripting language and had to back down." END EDIT
If you're writing code for mobile platforms, then I'm sorry, but it sucks to have to write it all 3-4 times. C# may be better than Java, but it's not relevant to me if I want to write Android/iOS games. If everyone used C++, then even the small-market phones (I'm looking at Microsoft here) would get ports of everything. At least iOS has somewhat native support for C++, which makes it easier to port games to/from Windows/Linux. The Android native support is unfortunately a neglected step-child of Google, though I'm fighting with it to get that compatibility.
And I'd certainly debate that modern phones are overpowered, but then again I write games. My G1 positively crawls--which I submit it wouldn't do if large portions of the OS weren't written in interpreted Java. I would totally agree with you that, on paper, there's plenty of power--but it's all wasted by inefficient code.
You know what really surprises me, though? How much CPU it takes to render a web page. Even when I'm on WiFi, the G1 is unusably slow at rendering web pages. And it's built on C++--and the Google browser, which is supposed to be fast. Opera and Dolphin are also pathetic on the G1.
Not that anyone will see this now that my original comment has been downvoted to oblivion. I guess you can't insult Java on HN and get away with it. No worries, though--the same thing happens on Reddit.
Mostly I just took issue with your usage of "scripting language" (which has more to do with a REPL and no discrete compilation step than anything else). The edit clarifies things a bit too; I confess to not following the original iOS app development details.
Thanks for taking the time to write an awesome response; you are definitely more savvy on the performance topic than me, and I'm disappointed to learn that the crunching power of modern mobile CPUs tends to be squandered.
Objective C has a lot of run time overhead due to its "message passing" paradigm. So any time you need to use a Cocoa API, it's pretty slow.
I hear over and over from experienced Obj-C guys that it's almost never message passing that's your bottleneck. (Just like how it's almost never your compiler that's wrong, it's almost always that you really did forget a semicolon.) Keep in mind that most of Mac OS X is Objective-C and it seems competitive performance-wise. I believe the Objective-C runtime even has some caching to make the performance of frequently-sent messages almost on the order of a function call.
Asm guys used to say the same thing about new-fangled languages like C: all that code that pushes/pops the function call stack was a huge slowdown. In practice, you just don't ever spend your time in function call stack manipulation code.
Not sure why Oracle is getting so much flak for protecting and monetizing their acquired assets. They are doing what Sun had failed to do, which is monetizing the Java platform effectively, thus leading them to sell themselves to Oracle.
Granted, software patents can be pretty meaningless and i believe that there should be no software patents at all. But this seems like the only way Java platform can be monetized (through licensing). I kind of wish Sun had the balls to do this kind of thing earlier.
If you're against software patents, it's for a reason, no?
That's sort of like saying that you admire one mafioso more than the other, because he has fewer compunctions about killing people in order to extort money, even though you're against the "killing people" tactic in general.
The entire Android stack is open source, and is not software that was implemented by Sun/Oracle. The class library comes from the Apache Software Foundation. Is Oracle going to sue Apache next? Who else might they sue?
What he means is that it was better to go through the wake-up call earlier instead of losing millions of dollars and man-hours on a language controlled by corporate interests.
I hate software patents, but it is the reality of the world. Google had a chance to license with Sun, but they did not want to yield any control to Sun and implemented their own technology for the mobile platforms. Sun/Oracle believe they violated their patents in this process. So they are suing Google. I do not see this as Oracle going after open source technologies.
Google is no champion of open technologies. No corporate company that has to answer their stock holders every three months can be a true champion of open source.
They are open only as long as it suits their business model. Right now making Android open source suits their business model bcos every stupid carrier on the planet can build a stupid android skin on their own, and Google can claim that Android is not a locked platform.
Sun tried to be truly open and they literally went bankrupt.
11 comments
[ 3.2 ms ] story [ 38.8 ms ] threadI know, let's force everyone to use a scripting language to write for underpowered phone hardware! We don't need native support! Just because Apple did the same with iPhone to start with, and it came back to haunt them later, doesn't mean that we won't get away with it! And don't forget Microsoft did the same thing with C#--look where it's gotten them! And while we're at it, let's pick a proprietary and patented language that's a laughing stock in language design circles!
I doubt this makes a dent in Android, though, and I would be amazed if this changes their Java strategy in the slightest. In a battle between Oracle and Google, I think the smart money is on Google.
This is kind of debatable, but I'd also say that modern phones are freakishly overpowered. The ARM Cortex IP used by the current generation phones really is a slick little architecture, and can definitely handle the overhead of running bytecode.
Objective C has a lot of run time overhead due to its "message passing" paradigm. So any time you need to use a Cocoa API, it's pretty slow. Somewhere I read that, as a result of Objective C overhead, the iPhone ends up about the same speed as Android in typical apps--so that with Android 2.2 getting a JIT compiler, it ends up much faster on similar generation phones.
EDIT: I just realized what you were confused about. Originally Apple said: "NO native SDK. You must use JavaScript on web pages to create iPhone apps." That's what I meant by "Apple started with a scripting language and had to back down." END EDIT
If you're writing code for mobile platforms, then I'm sorry, but it sucks to have to write it all 3-4 times. C# may be better than Java, but it's not relevant to me if I want to write Android/iOS games. If everyone used C++, then even the small-market phones (I'm looking at Microsoft here) would get ports of everything. At least iOS has somewhat native support for C++, which makes it easier to port games to/from Windows/Linux. The Android native support is unfortunately a neglected step-child of Google, though I'm fighting with it to get that compatibility.
And I'd certainly debate that modern phones are overpowered, but then again I write games. My G1 positively crawls--which I submit it wouldn't do if large portions of the OS weren't written in interpreted Java. I would totally agree with you that, on paper, there's plenty of power--but it's all wasted by inefficient code.
You know what really surprises me, though? How much CPU it takes to render a web page. Even when I'm on WiFi, the G1 is unusably slow at rendering web pages. And it's built on C++--and the Google browser, which is supposed to be fast. Opera and Dolphin are also pathetic on the G1.
Not that anyone will see this now that my original comment has been downvoted to oblivion. I guess you can't insult Java on HN and get away with it. No worries, though--the same thing happens on Reddit.
EDIT: See "EDIT" section above.
Thanks for taking the time to write an awesome response; you are definitely more savvy on the performance topic than me, and I'm disappointed to learn that the crunching power of modern mobile CPUs tends to be squandered.
Try taking c2d system and limit it to 128 MB RAM, without swap. It will crawl too.
I hear over and over from experienced Obj-C guys that it's almost never message passing that's your bottleneck. (Just like how it's almost never your compiler that's wrong, it's almost always that you really did forget a semicolon.) Keep in mind that most of Mac OS X is Objective-C and it seems competitive performance-wise. I believe the Objective-C runtime even has some caching to make the performance of frequently-sent messages almost on the order of a function call.
Asm guys used to say the same thing about new-fangled languages like C: all that code that pushes/pops the function call stack was a huge slowdown. In practice, you just don't ever spend your time in function call stack manipulation code.
That's sort of like saying that you admire one mafioso more than the other, because he has fewer compunctions about killing people in order to extort money, even though you're against the "killing people" tactic in general.
The entire Android stack is open source, and is not software that was implemented by Sun/Oracle. The class library comes from the Apache Software Foundation. Is Oracle going to sue Apache next? Who else might they sue?