|
Categories:
Recent Entries
Search entries Referers Disabled(referer spam)
NetNewsWire blogroll
|
Mon, 28 Apr 2008
::Should Java be on the iPhone?::
[/tech/mac] (09:56)
Even though Java bashing is the fashion of the day, I'm not afraid to say that I still love working with Java. I still consider Java the only credible choice for just about every flavor of web or enterprise development. Some might even label me a Java fanboy, though my affection for Java is purely pragmatic. By almost any objective technical measure, Java is usually going to be the best tool in the toolbox. You might assume then that I'm going to argue that Java should be on the iPhone. In some ways, I do think that. I think Objective-C is a nice language, and I've even argued that Java would be better off if it were more like Objective-C. That being said, I still think overall Java is better than Objective-C. Although the recent introduction of garbage collection is a a godsend for Objective-C, the language still feels like it's stuck 10 years in the past. Header files? Prefixes on every class name to avoid naming conflicts? It's just a clunky language. That doesn't mean it's bad. I really do like Objective-C. It doesn't have the comforts and conveniences of Java, but it gets the job done. The iPhone is also set up to be a security nightmare. I haven't looked too closely into the security of the iPhone yet. I know apps operate in a sandbox, and requiring signed binaries will eliminate many types of threats. However, given Apple's track record with holes in Safari on the iPhone I think it's pretty clear that we'll have the same type of security problems we've seen on desktop machines. Since the iPhone will be the dominant mobile platform, it won't be able to hide behind the small market share that has kept the mac desktop relatively safe. It is possible that Apple has most of the bases covered here since the iPhone is a small and tightly controlled environment, but I'm not entirely sure. Apple does a lot of things well, but security is NOT one of them. The iPhone would be much better off running apps inside of a virtual machine (like the JVM) with no direct access to raw memory or hardware. So, I'm arguing for Java, right? Sadly, no. You see, the key to the joy of Mac programming is Cocoa, and by extension what makes the iPhone great to work with is Cocoa Touch. Sadly, even though Java has had years to catch up, Swing is no Cocoa. As a Java guy, my first instinct would be to simply mirror the Cocoa APIs in Java. In theory you'd get the best of both worlds. Sadly, Apple tried that, and it didn't work out very well. Wrappers like that rarely do. To be fair, few Java programmers of the time were interested in developing apps limited to the Mac desktop, so Apple never had any incentive to really develop the Java bridge as fully as it could have. The iPhone would be a different story because it's a platform that Java developers would embrace developing platform-specific apps for. Still, I think a Java bridge for the iPhone would be a lost cause. Similarly, Java ME and Swing apps have no place on the device. The iPhone should run Cocoa Touch apps written specifically for the device and for the multi-touch interface. I'd submit Android as proof of that. Android applications just look goofy as they try to support more primitive 0-9 touchpad interfaces. Maybe I've been using a Mac so long that I've just turned into a snob, but I don't want ugly apps on the phone. If the iPhone allows non-Cocoa applications, then I feel we'll get a lot of junk Java ME ports instead of apps that look and work like iPhone apps. So, in summary, I don't want Java on the iPhone. I do wish the entire Cocoa stack were based on Java, and I do think it would be better if it were. But Cocoa is not Java, and as such there's very little that Java has to offer the iPhone right now. writebacks... comment... |
||||||||||||||||||||||||||||||||||