In Which I Think About Java Again, But Only For A Moment
It’s amusing how Steve Jobs’ remarks disparaging the idea of Java on the iPhone have ignited controversy. His point was, obviously, that the iPhone’s browser won’t support Java applets; which is a no-brainer because applets were killed dead-dead-dead by Flash and Ajax. But this seems to have riled up everyone who still cares about non-server-based Java, leading to the weird situation of seeing “Java” and “Mac” in the same sentence again*. Apparently some people still cling to the glorious dream of writing cross-platform GUI applications, waving tattered “Write Once Run Anywhere!” banners and clutching ‘Little’ Red Books with Duke’s picture on the front.
Flashback
Me, I defected long ago. I’m another of those Apple Java engineers who dropped out. I spent five years as a raving Java fanboy, but I gave up after optimizing AWT, implementing drag and drop, and trying to make 1,200 pages of crappy APIs do the right thing on the Mac. Then I took a one-week Cocoa training course, and wrote the first prototype of iChat.
Desktop Java never worked because Sun tried to build their own OS on top of the real OS, duplicating every API and feature. This led to terrible bloat, making every app as heavyweight to launch as Photoshop. Worse, the GUI portions of the Java platform are awful, because Sun is a server company with no core competency at GUIs. The APIs are too clumsy to code to, and compared to any decent Mac app, the results look like a Soviet tractor built on a Monday.
Why Cocoa Pwnx0rz
That Cocoa training class was, as I’ve said before, one of the biggest eye-openers of my career. It was so damn easy to build beautiful, functional applications that I walked out feeling like I’d climbed into some giant mecha robot and could now lift huge girders with a wave of my pinky.
Three important things you need to be able to make apps with great human interfaces:
- You need to lay out the user interface components visually, by hand, with total control over where they go. Automated LayoutManagers don’t cut it. A corollary of this is that you can’t move a UI layout from one platform to another and have the computer make everything fit. Computers don’t lay out interfaces by themselves any better than they can translate French to English by themselves.
- You need to be able to change the UI around really easily during development — after user testing, or a Steve Jobs encounter session — even after you’ve attached a lot of code to it. That means no RAD tools that write code for you, because once their code mingles with your code, it gets hard to disentangle. Instead, the UI should be described with data, like an Interface Builder “.nib” file.
- Changing the UI around also requires being able to change your own UI code easily. As the Ruby and Agile Programming zealots always point out, strict type checking can really get in the way of this. Writing endless Listeners and Adapters and inner classes was one of my least favorite parts of Java programming. Objective-C and AppKit have a good approach, letting you use type-checking where it’s important but leaving looser connections at the UI level so you can plug and re-plug connections easily.
My Theory
My theory is that Java desktop apps succeed only in niches where UI design and usability don’t matter: development tools and enterprise software. Programmers expect things to be crude and complicated: anyone who’ll voluntarily use ‘vi’ in the 21st century will put up with anything**. And the poor users of enterprise software don’t have a choice: they have to run the damn app no matter how awful it is, because it was selected by an MIS department that could care less about usability.
Footnotes
- Not that this controversy has anything to do with the Mac. The iPhone is not a Mac, the Mac still runs Java, and no one is talking about taking it away.
** And that goes for ‘emacs’ too (with apologies to my boss). I thought emacs was really cool, in 1986. That’s when it was really cool to have a DEC VT220 terminal in my dorm room with a 9600 baud connection to a VAX running BSD 4.3. Also, I listened to Depeche Mode.
January 22nd, 2007 at 5:39 PM
Hey, I still listen to Depeche Mode.
January 22nd, 2007 at 6:07 PM
Because creating an excellent UI is more than just using the API to build an application. It’s knowing what the correct rules for behavior is on the target platform.
For example, on a dialog box that presents the user two buttons (“OK” and “Cancel”), on which side should the “OK” button go? Under what circumstances should you replace “OK” with an action verb that signifies better what is being done when the dialog is dismissed? What verb should you be using?
Yes, this is a nit-picky example. But UI development is more than just tossing together some APIs and getting something nice. It is about creating a program which preserves the illusion that a symbolic concept (a stream of bytes, for example) is actually a material thing (a text document) and can be manipulated in a way which is analogous to the real world, using the user interface conventions and human interface guidelines of the target environment.
A User Interface is an illusion, and like any illusion, the moment the user sees the dove behind the table top because a mirror is misaligned, the entire magical experience breaks down because for that split second disbelief cannot be suspended: you know the dove came out of a black cloth stapled behind the table top, rather than appearing out of thin air as if it were magic.
And to preserve this illusion, it means getting every last damned detail—especially those that are not controlled by the API—correct. Including picking the right verb to replace the OK button label that sits to the right (or left, if Windows) of the Cancel button on one of a dozen dialogs in your application.
The very fact that you cannot recognize that there is a greater problem than the selection of APIs and the relative power of those APIs—and that you are willing to shift blaim to Sun so easily—strikes me as extremely telling.
January 22nd, 2007 at 6:57 PM
We are an enterprise software development company with our own CRM, which was built in Java but are making the move to a Flex/Apollo front end. For us Java will be nothing more than a web service. Java developers prepare to take a middle seat or learn a new language because you the glory days are over.
Have good looking UI’s is no longer good enough not even for Enterprise Applications, they need to make users lives easier and look and function like the Iphone demo. Its coming……in two years if your UI isn’t rich your app will have to compete on price and that means its the end of your products life.
January 22nd, 2007 at 8:06 PM
pffft nubz, get a life. Java is here to stay
January 23rd, 2007 at 1:51 AM
Reading the comments, I decided Apple trusts to their fans and fan developers and can choose anything to do which won’t effect anything at all.
If I didn’t respect [not afraid] NDA, I would easily prove Apple hates Java and it has became more obvious in 2006 on desktop.
Yes I am an Apple user but it doesn’t make me claim weird things like java is dead. Java is dead when Nokia doesn’t include it, not the iPod manufacturer.
January 23rd, 2007 at 9:02 AM
Have you seen BlogBridge? It’s a cross-platform Java desktop app, and scores high in design and usability IMHO. Or, if you’re into the new glossy-everything look, check out Aerith — very very slick.
January 23rd, 2007 at 9:23 AM
Sure, you can make ANY toolkit look good if you just ignore the toolkit and implement your own widgets. That’s rather anathema to the point to a toolkit to begin with, though, and also leads to a UI which may or may not perform correctly for the environment, especially with accessibility. I haven’t used either of those apps, but how well do they follow the various operating systems’ ideas of keyboard accessibility, shortcut keys, mouse click semantics (e.g. action-on-button-release, cancel by dragging away from the button) and all the other stuff that a toolkit already provides for you like drag-and-drop, event handling, and so on?
Also the point about Jens’ rant wasn’t whether or not a Java app *can* look good, but whether it’s worth it to, when there are better APIs out there which aren’t so developer-hostile. wxWidgets (for example) is MUCH easier to use than Swing/AWT, and produces much more consistent, platform-targetetd applications with much less effort. Also Cocoa apps don’t have to be OSX-only thanks to GNUstep, though the GNUstep look and feel has certainly fallen behind at this point (and I don’t know how well-supported it is under Windows). And anyway, as someone else pointed out, you should write all your apps using an MVC model anyway (which Cocoa enforces) and there’s no reason M and C have to be in Objective-C, and V is all that’s platform-specific.
Mozilla was written to be cross-platform by writing their own UI toolkit (XUL), because they thought that they could make a single API which would be portable to every OS, but one of their more prominent developers later said that it was a huge mistake - it turned out that maintaining a single UI toolkit on three platforms was much more work than it would have been to just maintain three separate UIs to a common rendering backend. Of course, now that XUL exists it’s a pretty okay way of defining user interfaces in a cross-platform way, though even XUL’s poster child app (Firefox) has serious accessibility and integration problems on various platforms (ironically and most notably, Linux).
So okay, you have two good-looking Java apps. That doesn’t prove that Java is a winning strategy.
January 23rd, 2007 at 9:41 AM
I just tried out BlogBridge. Well, sure looks ok (but why the different-at-all-cost L+F? why not use something standard?), but usability? blech. This is the first blog reader ever that totally overwhelmed me with an elephant of a UI and where I didn’t find the menu entry “subscribe to blog” in two minutes. Deinstalled.
@fluffy: what’s wrong with a NetBeans-created GUI in Swing? Why do you have to ignore Swing to get a good-looking app?
As to WXwidgets: on the Mac I always found Qt and WX apps the worst (except for X window apps), i.e. I preferred Swing apps. Now on Linux I also prefer Swing as well, since it can look like Gtk, while Qt and Wx are, well, Qt, which I don’t even have installed (nor do I want to).
XUL? Just say no… Probably the hardest way to create a GUI (even just creating a theme). A platform that isn’t completely general-purpose (unlike Java), that still has no shared install-only-once runtime (XULrunner, when do we get TB/FF/SM running on it?), and that has the absolutely craptacular Eclipseness of having to specify every little fart in XML. And you don’t have great Java tools available, but whatever for XML.
January 23rd, 2007 at 9:47 AM
Sorry, I just noticed that WXwidgets isn’t Qt at all. Still, their screenshots like very Windowsy, to say the least.
January 23rd, 2007 at 10:16 AM
Flashback: “Desktop Java never worked because Sun tried to build their own OS on top of the real OS, duplicating every API and feature. This led to terrible bloat, making every app as heavyweight to launch as Photoshop. Worse, the GUI portions of the Java platform are awful, because Sun is a server company with no core competency at GUIs. The APIs are too clumsy to code to, and compared to any decent Mac app, the results look like a Soviet tractor built on a Monday.”
http://toastytech.com/guis/sol10.html
Better have been one hell of a flashback, hippy - Solaris 10 has a really nice GUI and guess which parts of it aren’t made of Java? Can’t believe nobody’s said anything about this?
January 23rd, 2007 at 4:35 PM
[…] Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL. « links for2007-01-22 […]
January 23rd, 2007 at 9:23 PM
Jens, thanks for putting this all in perspective. I’ve been doing private projects with Cocoa while trying to make a living with Java, and this sums up my experience perfectly. The only reason I don’t give up on Java is that I can’t find a Cocoa job and the alternative is Windows (shudder).
January 23rd, 2007 at 10:31 PM
[…] In Which I Think About Java Again, But Only For A Moment — Thought Palace this is interesting, considering the fact that i’ve actually begun using a couple of desktop Java applications again (tags: Java desktop applications iPhone Cocoa Apple os-x) […]
January 23rd, 2007 at 11:32 PM
The reason you never got jiggy with java: Not enough design patterns. You need to add lots of ‘em. Just pour ‘em in there and shazam!, everything just works. And if not, at least you can put “Design Patters” on the resume. Enterprises love that!
January 24th, 2007 at 12:27 AM
[…] I remember during the Java affair how much I wanted to believe in “Write Once, Run Anywhere.” Jens Alfke has a little blurb on his blog that outlined some of the reasons why the Java desktop never amounted to much. Desktop Java never worked because Sun tried to build their own OS on top of the real OS, duplicating every API and feature. This led to terrible bloat, making every app as heavyweight to launch as Photoshop. Worse, the GUI portions of the Java platform are awful, because Sun is a server company with no core competency at GUIs. The APIs are too clumsy to code to, and compared to any decent Mac app, the results look like a Soviet tractor built on a Monday. […]
January 24th, 2007 at 4:22 AM
“Jens, thanks for putting this all in perspective. I’ve been doing private projects with Cocoa while trying to make a living with Java, and this sums up my experience perfectly. The only reason I don’t give up on Java is that I can’t find a Cocoa job and the alternative is Windows (shudder).”
Exactly, and a better reason for using Java rather than Cocoa is difficult to imagine. It doesn’t matter how good Cocoa is technically, it’s a closed proprietary platform that doesn’t work on 95% of the world’s computers and is therefore pointless, assuming you’re doing anything other than tinkering on a private project for fun.
January 24th, 2007 at 12:41 PM
[…] No look, no feel. Jens Alfke on the dead-before-arrival Java UI: “The APIs are too clumsy to code to, and compared to any decent Mac app, the results look like a Soviet tractor built on a Monday.” (Via Simon Willison) […]
January 24th, 2007 at 3:49 PM
Fractal Linking Cascade about Java…
John Gruber linked to two articles by Paul Kim and Terrence Talbot about Java, following Steve Jobs’ remark about it not being worth building into the iPhone. I foolishly went to read them, not realising that I was being caught into a Fractal Linking …
January 24th, 2007 at 4:08 PM
[…] In Which I Think About Java Again, But Only For A Moment versammelt ein paar Gedanken eines Ex-Java Entwicklers bei Apple, der nach einem Crash Kurs in der Programmierung mit Cocoa den Chat Client iChat mitentwickelt hat. […]
January 24th, 2007 at 8:27 PM
“Exactly, and a better reason for using Java rather than Cocoa is difficult to imagine. It doesn’t matter how good Cocoa is technically, it’s a closed proprietary platform that doesn’t work on 95% of the world’s computers and is therefore pointless, assuming you’re doing anything other than tinkering on a private project for fun.”
GNUstep. Seriously. They’re also working on a Windows backend now, which is now considered beta-quality.
Cocoa isn’t Mac-only, and never has been.