Sunday, July 20, 2008

And again, Java on the iPhone...


We've been doing some software development work on Apple's iPhone using the legit toolset. And of course, most of the guys working with me have their C skills as rusty as old wild west nail - leave alone their Objective-C ones...

We opted for Objective-C because of the all-too-known reason that Java simply isn't there. Sun and Apple have been struggling for ages regarding Java implementations on the Mac - figures - the iPhone didn't turn out different.

Quite a while ago, Steve Jobs went very vocal regarding a possible Java implementation on the 412Mhz, 128Mb RAM device: "Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain." This made it sound like a technicality, a business decision made upon imposition by the heavy restrictions Java puts on the hardware platform. Not so - many mobile phone platforms are way way slower than the iPhone, and still run snappy (ok, and sometimes not-so-snappy) Java apps.

After joining Apple Developer Program, and doing our first developments, I now believe that NOT implementing Java on the iPhone is, these days, CRITICAL for Apple's business model, regardless of any technology decision.

Still, there are two distinctions to be made. When people talk about Java on the iPhone, they usually mean either a) Java support on Mobile Safari, in order to run and render Java applets on the device and b) native JVM support for developing mobile Applications such as those that appear on the phone's Home screen.

In the first case, I dont really think it would me a major issue to allow java to run as part of Safari. As a matter of fact, if there is to be ANY Java support for the iPhone, I believe this will be the only way - in a heavily sandboxed environment, where Java will be used mostly as a runtime for browser-embedded snippets or Java-FX sites. I believe Sun really needs (and is already leaning) to showcase that Flash/Flex can have a serious contender in the battle for interaction-rich, non-AJAX RIA applications.

As for the second case, it gets a bit more complicated. It is now pretty much public domain that even if one wanted to write a JVM for the iPhone, we couldn't, at least with the agreement leaked many weeks ago, and that anyone can find over the internet with a Google search. In it, Apple specifically prohibits interpreted code, plug-in architectures and the such, in a way that makes it pretty clear that a JVM cannot be easily written under such agreement. And even if it could, even if one could write a JVM as a native application, it would still not be enought to provide end users the same experience as native phone apps would have: Cora Animation, Coccoa Touch and the other nifty API's that make up so much of the UI experience would have to be bridged/reimplemented, many times in ways that would certainly breach the developer agreement once more.

So, why? Why is Apple allowing users to publish free applications in the App Store, but yet explicitly forbidding them to write code as they want, in any language or environment they feel most comfortable in?

Obviously, control. If one could write downloadable, boundless interpreted code, there would be no way to effectively limit "dangerous" applications such as VoIP, Navigation, or even Porn, all forbidden under the Developer Agreement. Now, don't get me wrong - this is legitimate corporate policy. Even understandable, in fact. But it may have consequences, both for Apple and Sun.

As iPhones gain momentum in the market, a huge number of Java Developers that would be eager to write innovative applications for such an interesting platform will have to make the Java-to-Objective-C leap as we're doing. This is wasted potential for Apple, as many simply won't make this jump. This is a wasted opportunity for Sun, as it won't be able to position the technology effectively against Flex and Flash. And it is wasted knowledge and proficiency for the developers themselves, since they will have to cope with a steep learning curve that brings mostly unproductivity and frustration, and discards one of the most widely used programming languages for the device.

And finally (and this is the one that doesn't make sense) - why, oh, why, can't we at least have an Apple-supported Java cross compiler in Xcode for the iPhone?

Sorry for the rant.




Anonymous said...

Interesting blog.

What do you think of chances of success for products like alchMo for iPhone to catch on if there is no direct support of JVM on iPhone?

Hugo José Pinto said...

Hi! Thanks for your comment.

Curiously, one of our guys, Bruno Antunes ( has been trying to get in touch with them in the last few days.

The technology looks very interesting. Still, I believe that for it to work they'll either have to a) target jailbroken iPhones (that won't need Apple's permission to install any app) or b) really approach Apple in order to strike some sort of agreement that allows your application to be made available on the App Store.

In sum: I believe they have the potential, IF they have already realized that although their technology has what it takes to be way cool, this is essentially a business problem that must be solved directly with Apple.

But that's a big IF. :)


Hugo said...

Diya Roy is a premier escort agency in Guwahati that provides call girl services or
escort services in Guwahati hotels at cheap and affordable fixed rates
Assamese call girls in Guwahati
College call girls in Guwahati
Housewife escorts in Guwahati
Russian escorts in Guwahati
Model escorts in Guwahati
Nepali call girls in Guwahati
High profile call girls in Guwahati
VIP escorts in Guwahati
Female escorts in Guwahati