Posted by evanx
on May 10, 2006 at 5:03 AM PDT
Health warning: This is a long posting about "Swing versus everything else" and more. I'll split it up in coming weeks into Swing vs .Net, Swing vs SWT, Swing vs GNOME and KDE, Swing vs the Web 2.0, et al, so wait for those if you can, rather than read this bloated rant. If you do read this, note that italicised text is all off topic...
Joshua Marinacci asked what's stopping people from shipping Swing applications: was it the large JRE to download, or difficulty in Swing programming, or what? That was a really great question that enjoyed a lot of comments. Including this one, which goes right off topic.
Most contracts/companies i have been involved with are all deploying Swing apps, woohoo! Stands to reason since i'm a Swing developer, innit.
Developers complain that Swing components are buggy "on the edges." Now i'm talking about bright colleagues (not me) that tried to make Swing components deliver some corner-case functionality. These colleagues also complained bitterly about old bugs not getting fixed, even after years. Presumably because of Sun's focus on web/JEE in the dot-com/server-side era which is understandable, or maybe because fixing them could break some customers' applications, also understandable.
Lemme digress, about Sun and opensource and Java, and say that, i love Sun, for Java, Netbeans and OpenOffice. Sun adopted BSD in the early days, and have opensourced Solaris (albeit to counter Red Hat, but still). They have contributed their enterprise Java stack to Glassfish (probably to counter JBoss, um... Red Hat). In addition to Netbeans, they have opensourced all their developer tools, like Creator, and the C/C++ one too (partly to counter Eclipse, from IBM, their other nemesis). Inevitably Sun will opensource Java. They will do it to counter C# (their Redmond nemesis), Harmony (supported by IBM), and GCJ (Red Hat). Sun wants developers to be a field of Sunflowers, following the Sun. Sun's next step is for Linux distributions to follow FreeBSD's suite, and include Java and Netbeans, woohoo!
So if i appear to "criticise" Sun at any point, that's just a joke. And as the Russians say (loosely translated) "Every joke is partly a joke". Another russian joke is: "You know why you can't have sex in public? Because you'll get too many suggestions!" - as Sun well knows.
I love Swing. First it frustrates you, then it becomes the "devil you know," and then it really starts growing on you. Lemme digress about Mono! Why did the Mono people embrace .Net rather than Java, which is Linux-friendly? They could have written an opensource Java with superb GNOME bindings rather than .Net Mono. According to the US government and the European Commission, Microsoft abuse their competitors something awful. I don't think that they will abuse Mono (thanks to Novell's XML patents), but still, Java would have been a safer bet.
Since Mono gives GNOME's "unixversal" platforms a foot-up to run Windows .NET applications, i assume Mono's choice of C# over Java is, at its root, a Linux-advocacy decision (to see flat the desktop mono-poly), rather than a pure technology decision. (Excuse me when i mistakingly say "Linux" when i actually mean "GNU, GNOME, KDE/Qt, GNU/Linux, *BSD, Darwin/MacOSX and OpenSolaris.")
The Mono guys will argue that C# is a better language and has easier native library integration, which is clearly very important for GNOME. Still i wish the opensource community would unite behind Java. When Sun opensources Java, we'll have a complete opensource Java "stack" including tools (eg. Netbeans, Eclipse) and enterprise platform (eg. Glassfish, JBoss).
The problem with Mono, Python et al, is that they do not have awesome opensource IDEs like Netbeans and Eclipse. In my opinion, this makes them less suitable than Java for many project archetypes. (By the way, having this "opensource" Java development stack doesn't help the Mono guys because their philosophy requires "free software," and so "opensource" just won't do.)
Lemme digress even further off topic about Mono vis-a-vis GNOME vs KDE... C# is an attractive option for the next generation of opensource desktop developers. So i expect that the GNOME developer community will grow the fastest, in which case GNOME might overtake KDE, notwithstanding the RADness of Qt/kdelibs.
At some point, MacOSX might want to move away from Objective-C towards a "modern C." I predict it will be C#/Mono, because that would enable MacOSX to win over Windows developers, applications and users. So "desktop Java" is sidelined in a possible future where most Windows, Linux, and MacOSX developers might favour .Net/Mono for new desktop applications. And desktop tinkerers grow up to be enterprise programmers, so...
I look forward to a practical Java desktop emerging from Looking Glass, one that encourages young opensource developers to tinker with Java/Swing, rather than C#. Otherwise... "Houston, we got a problem." Java is perfectly poised right now, with Netbeans 5, JDNC, Glassfish, and millions of students being taught Java... Hopefully the Java Community will capitalise on this, and achieve world domination, woohoo! I want a Jubuntu desktop with a Looking Glass desktop manager, and "NetFinder" - a super-browser built on Netbeans RCP, with modules like Gecko renderer, ODF viewers, GMailer, GDriver, GoogleData editor, WebStart... Oh man!
Back to the main thread, which is Joshua's question why people might not be shipping Swing applications?
Let me say right out: Swing looks beautiful and is plenty fast enough - just look at applications like IntelliJ and Netbeans. And Swing just gets better, in every department, with every release. I'm sure the Netbeans team, and the Java Desktop community, have been giving great feedback to Sun's Swing developers, and it shows.
Lemme digress! Why did IBM Eclipse develop SWT, when they should have predicted Hotspot and Swing optimisations, and did the math with Moore's Law and realised that the best not-short-term solution is Swing and not SWT!? Now they have to test and debug everywhere, ouch! Fix SWT on MacOSX and, darn, you break the Windows bindings under certain conditions. They must be chasing their tails supporting native bindings on multiple platforms. Heck, the Mono guys gave up on a native binding of WinForms to GTK, and are gonna settle on Swing's approach of "lightweight" components and events, programmed in C#, atop a minimal native drawing layer. And those guys are incredibly clever - MdI is probably the best desktop programmer in the world, innit.
Incidently, a by-product of Swing's lightweight approach, is that it makes it feasible for projects such as GNU Classpath to deliver an opensource Java implementation, which together with IBM donating their JVM to Harmony, might spur Sun to opensource their Java implementation.
Some people argue that blazing performance is all that users want. I argue that better usability plus new features, is what users want sooner. (With near-blazing performance if possible please!) So it's gotta be blindingly quick and easy for teams of developers to deliver features that users want. That's why we gotta use modern languages like Java, with its safe syntax, memory-management and extensive libraries, and great tools like Netbeans and Eclipse. Thankfully, Moore's Law doubles our application's performance every year, for free, and JDK engineers boost performance with every release. And we can use the Netbeans profiler to join the party.
But back to Joshy's question...
My impatient wish is that JDNC/SwingX was more extensive and mature already. We need this rich and extensive set of high-level components for throwing together archetypical apps right off the bat, eg. business apps that any old analyst programmer can handle - no computer science PhDs or opensource propellerheads required!
I suspect we lack this simplicity (through a standard framework and components as promised by JDNC/SwingX) after 10 years because AWT/Swing was envisaged as a web/consumer/desktop application platform rather than an enterprise application
presentation platform. And because Java's focus quickly shifted to the web and server-side, and Swing lost some attention in all the dot-com excitement.
It appears that much work has been done on JEE/EJB, and relatively little on Swing as an presentation platform for JEE applications, eg. JDNC. "That's mentil!" (That's from the BBC Series "The Office", when everyone tells David, the manager, that they preferred the other boss Neil's jokes. David says "Thaaat's mentil!" and storms out. Heh heh.)
So this cuban friend of mine used to start every sentence with "Attention!" pointing his finger, and ended every sentence with "Unnerstan!?". As in one of his memorable quotes: "Attention! In Cuba you do what the gover'ment want you to do, not what you wanna do... Unnerstan!?"
Attention! WebStart is not realising its huge potential yet. Maybe it should be pimped with some more eye-candy and feature-candy to promote Swing as a rich internet application platform. Maybe rework it as a module suite built on Netbeans RCP. Unnerstan?
So back to Joshy's question: who is not developing and shipping Swing? This brings me to the main thrust of this blog and if you believe that you'll believe anything.
There is one company i worked for recently that ships a JBoss application when it really really should have been Swing. It's a big intranet application run in hundreds of sites. They went web-based rather than Swing/WebStart, and their developers and clients and themselves are paying a very big price for that decision, because web applications are so convoluted and kludgy! Maintaining the application and adding functionality is very slow and difficult. Granted this company's architecture has other problems that exacerbate their situation, but lemme press on before i forget what i was going to say... Darn, i have actually forgotten! Oh yes...
So why did this company go the web route? Because everyone's infatuated with the web as a platform. Lets rather leverage the web as a Swing application delivery platform, not an application platform in itself.
Ajax might make Web 2.0 applications a better experience for the user, but Ajax doesn't make developers' jobs fundamentally easier. In the crystal ball of my dreams, Web 3.0 is powered by Swing, JDNC, and Webstart, and not Ajax. And not .Net with Avalon or WinForms or whatever.
Now for the obligatory discussion about Google, because everyone talks and writes about Google all the time, and so why should i be contrary?
I argue that Google Calendar and Google Mail would be considerably easier to develop in Swing rather than Ajax. Soon some Web 3.0 startup is bound to build a better Google Calendar, GMail et al, in Swing, using Webstart, and they will rubbish all Web 2.0 Ajax applications faster than you can google. Swing webapps will have more richness it their little inbox than GMail and Zimbra put together, and their simplicity and agility will ensure that enhancements come fast and furious.
I also wonder, compared to developing GMail (which is a technological feat), how relatively difficult would it be for Google to zhouzh-up Thunderbird to support their GMail back-end transparently, including persisting contacts, settings, et al, to your GDrive - ie. make Thunderbird a stateless rich client internet application. I can't accept that people are not willing to download a 5Mb Google "GoZilla" client, which loads its configuration from your GDrive, rather than your local filesystem. I wish that GDrive-powered versions of Thunderbird and OpenOffice are coming to a Google Pack near me soon, woohoo!
People are banging on about web-based office software. Look at Writely, and then look at ThinkFree. Clearly, the web browser is a pitiful application platform compared to Swing for desktop applications. And worse news for us developers, is that it's so much trickier to develop (and debug and refactor) Web 2.0 "rich internet" applications compared to traditional apps in Swing (or .Net/WinForms or Mono/GTK#). With a framework like JDNC, and a tool like Netbeans, Swing is a webstart dream waiting to happen!
As the designer of the NASA Apollo computer pointed out, the most reliable components are those you leave out. We not gonna leave Java out, so lets try to leave out everything else that we possibly can, like all that convoluted web presentation stuff. Keep it simple, safe, easily deliverable.
To wrap up, my dream for the future of computing, is stateless rich client applications using web data services, where we cache in on rich applications via the web (using some kind of mashup of Google Toolbar, Google Pack and WebStart), and where your documents and settings follow you around on your GDrive.
So if your hard-drive crashes (or you walk into an internet cafe, or sit down at a colleague's computer), just pop in a live/install USB key (or not), login in to your Google/Yahoo/Live account, and you're good to go - your documents, settings, and program shortcuts, are all at your finger tips, exactly where they were last time you logged in. So I love what Red Hat is doing with "Stateless Linux." And I hope Google and Sun are cooking up a "OpenOffice with GDrive stateless dressing" free lunch in your Google Pack.
I suspect that OpenOffice is gonna light the way to Web 3.0, with purposeful integration to your searchable GDrive repository. Ok it's not in your browser, it's from your browser, so what?. Have a cup of coffee while OpenOffice2Go and Thunderbird2Go downloads/updates, and thereafter forever have a richer application to use everytime and anywhere - nicer for the users, and easier on us developers.
Similarly with enterprise applications. I hope they are going to use Swing and not Ajax. Then everyone's a winner - end users get a richer application, and features coming sooner, and developers enjoy rapid painless development and happy users.
Disclaimer: I'm a Swing developer, writing a Swing framework, namely aptframework.dev.java.net - so take everything i say as self-serving conjecture, which is exactly what it is, with the main purpose of having this opportunity to shamelessly plug myself and my project, so...