Client-side Java's evolutionary leap

Looking back on a year of changes

1 2 3 4 Page 3
Page 3 of 4
Danny Coward responds: Maintaining backwards compatibility has been the virtue and vice of the Java API set since 1996. On one hand we have this big issue with people still on older versions of the JDK because they are hesitant to migrate in case something breaks (the issue for us being that we spend engineering time maintaining a trail of old JDKs instead of working on new stuff). On the other hand people like Kirill are busy innovating, and the JDK is a great vehicle to get new and experimental ideas out even if some of them turn out to need changing. But I don't think it's one thing or the other: I think there are ways of supporting that experimentation on top of the APIs without experimenting with the current API set. This is the path that Java EE is on: the basic stuff is there, many developers now use one framework or another on top of the Java EE APIs, and the EE APIs are in this mode of enabling those frameworks better, extensible deployment descriptors and use of annotations being two examples. With the rise of JavaFX (which uses many of the Swing components in the desktop profile) and RIA frameworks like Griffon (Swing + Groovy) I think the scene is set for us to think about what those enablers are, the Swing App Framework being a good example.

Richard Bair is a longtime speaker and member of the Swing Team at Sun. He also leads the development of JavaFX's component toolkit API. I asked him about Swing/SwingX, including a comment he made in an interview with Kirill Grouchnikov:

Q: In your December 5 interview with Kirill, you said: "To those people who say we should make a Swing2 which is not backwards compatible, I would say, this is exactly what we're doing with JavaFX." Various sources have interpreted this comment to mean "JavaFX = Swing 2.0". Is this a fair assessment?

Richard Bair: Yes, that's exactly the message I was trying to convey. JavaFX will have a completely new Control library, which will be essentially Swing 2.0. We're taking all the good things from Swing (including property names and so forth where it makes sense), all the good things from SwingLabs, all the lessons learned, and applying them to a new toolkit.
I should add that JavaFX is much more than just the next Swing -- it also has Web services APIs and so forth. It is really the next client stack from Sun Microsystems built on the foundation of the Java platform.

Q: Many developers are frustrated by Sun's emphasis on JavaFX at the expense of Swing and SwingX. Was there an overlooked bright spot for Swing/SwingX in 2008?

Richard Bair: It's true that getting JavaFX released has been a lot of work and required a necessary refocus of developers within Sun to get it out the door. I think that as Swing developers become more familiar with JavaFX and as we begin releasing more enterprise application components into JavaFX, Swing developers will be very excited with what they see.
I think one fantastic development in the Swing world has been the growth of strong third-party contributors to the world of Swing. We've also seen several "Swing 2.0" projects start this year, which is great. It shows the strong interest that Swing developers have in seeing desktop Java succeed. JavaFX is really about amplifying that success. We're very strongly committed as a team and as a company to the success of the client Java platform.

Q: Although Swing is a mature technology that's widely used in enterprises, it has a large footprint, and it appears that much work would be needed to integrate SwingX components into Swing. Do you see Swing continuing to grow, or do you see a time approaching when future work on Swing will be halted?

Richard Bair: We are building a new toolkit for JavaFX which takes all the best from Swing and SwingLabs and the JavaFX Script language to create what I think is shaping up to be a really powerful library. Swing will continue to grow and be supported. The important thing to understand is that, as you said, Swing is a very mature technology, which is deployed and used by our customers with millions and millions of lines of code, and as such will continue to grow, but at a slower pace than a young toolkit would. Will we add some more components? Yes, we have plans to bring a few more components from SwingLabs into Swing.
We're also planning on finishing the work on JSR 296 (the Swing Application Framework) for Java 7. So clearly we're still investing in Swing technology.

Also noted: OpenJDK, Ganymede, desktop apps

Sun's JavaOne 2006 announcement that Java would be open sourced led to the formation of the OpenJDK project, which is creating an open source version of JDK 7. OpenJDK experienced some milestones in 2008. A completely open source JDK 6 was bundled with the Fedora 9 Linux distribution. Perhaps a more significant development was the announcement of the first code committed to OpenJDK by Roman Kennke, who is not a current or former Sun employee. More committed code from others not involved with Sun is likely to follow.

While Sun was busy working on NetBeans, the Eclipse Foundation was busy with its rival IDE. In June, the foundation released Eclipse Ganymede, which contained version 3.4 of the Eclipse platform and 23 projects. Another interesting development occurred at EclipseCon in March, where Microsoft's Sam Ramji announced the beginning of Microsoft's collaborative work with the Eclipse Foundation.

Other members of the Java community were busy releasing client-side Java products in 2008. For example, Michael Kölling introduced a BlueJ plugin for NetBeans 6.1 (in September) and BlueJ 2.5.0 (in October). I asked computer science professor and Java author Cay Horstmann to look back over 2008 and tell us which product(s) made the biggest impression on him:

Cay Horstmann: It is sad that I had to think quite a while about this question. BlueJ is a great product, but a BlueJ 2.5.0 release in October is hardly a validation of client-side Java. In fact, I could not think of a single exciting desktop Java product that came out in 2008. I am looking forward to the new version of Alice, which will be exciting, but that's in 2009.
I am certainly in the target audience for Java-based apps. I mostly run Linux, and sometimes Mac OS X and Windows. Cross-platform is very important to me. I run Eclipse or NetBeans every day. Apart from that, the pickings on my computers are pretty slim: Alice, BlueJ, Dr. Java, ExecuteQuery, GanttProject, Greenfoot, jUploadr, SQuirreL, Violet.
Why is that? The standard argument is that Swing apps are slow, look ugly, or hard to code. Slow? I don't know -- Eclipse and NetBeans are huge programs but they run fine for me, certainly no slower than Visual Studio. Ugly? As a Linux user, I have to laugh. Most of the apps that I use everyday (OpenOffice, Amaya, Thunderbird) are even uglier. Hard to code? It is way harder to program in GTK+, wxWidgets, or XUL than in Swing.
I do see plenty of interesting projects in research and education, and Java is used for almost all of them because it is cross-platform and easy to program. But there is a fly in that ointment. Java is way behind in support for modern hardware (pen or touch input) and media types (audio/video). That's where a lot of action is, and Java will lose its natural advantage quickly if it doesn't catch up.
Of course, if you asked me to name an exciting C# or Flex app that blew me away in 2008, I'd have the same answer: None. So maybe this is all just a sign of maturity in desktop apps.

On the horizon for 2009

As we look ahead into 2009, we can be certain of some upcoming developments in client-side Java. For starters, JDK 7 will be previewed at JavaOne. Also, we'll witness the arrival of JavaFX Mobile SDK and other JavaFX releases. Undoubtedly, we'll finally get to play with JWebPane. And we can count on a few other developments.

JavaOne 2009 and the JDK 7 preview

In mid-December, Danny Coward announced that JDK 7 will preview at the JavaOne 2009 conference and shared the strongest indications to date on some of the items that will make it into JDK 7:

  • Project Jigsaw for modularizing the JDK
  • New low-pause garbage collector (Garbage First)
  • Better performance
  • Language changes
  • NIO2 (New I/O, the next generation)
  • Swing Application Framework
  • Annotations on Java types
  • XRender graphics pipeline
  • Stream Control Transport Protocol (SCTP) support
  • Unicode 5 support

Coward refers us to Joseph D. Darcy's blog to learn more about upcoming language changes. In his post Coming Soon: A JSR for small language changes in JDK 7, Darcy mentions that he is heading up Sun's efforts to develop a set of small language changes in JDK 7 and will submit a JSR for them in the first half of 2009. I had some questions about that.

Q: Can you tell us about any small language changes that will definitely appear in JDK 7?

Joseph Darcy: Nothing is certain yet, but strings in switch and more concise declarations to initialize generic variables are very likely changes.

Q: Are there are any plans to further enhance generics in JDK 7? For example, can you tell us if Bug 5098163: Add reification of generic type parameters to the Java programming language will be addressed?

Joseph Darcy: No, adding reified generics will not be done for JDK 7; some of the rationale is discussed in my  measuring language change size blog post. Reification would not be a small change; nontrivial JVM enhancements would be needed to maintain performance, and there are various compatibility issues that would have to be worked through.

Q: Does Sun plan to address this bug in JDK 8?

Joseph Darcy: I think we need to get a bit further through JDK 7 before much planning for JDK 8. Adding reification would intrinsically have a somewhat high effort compared to the potential reward, since only programs that wanted to use certain kinds of reflective operations would benefit.

Project Coin

Subsequent to our discussion, Joseph Darcy announced Project Coin, an OpenJDK project for hosting the small language changes to be introduced in JDK 7. Darcy mentions that both this project and a mailing list for proposing language changes will debut in February.

While thinking up a potential small language change, keep in mind that Darcy is already considering adding strings in switch, more concise calls to constructors with type parameters, exception enhancements (multi-catch and final rethrow), the ability to call foreign language methods with exotic names, and (possibly) bracket notation to access collections.

We can add Java SE 6u10 features (Nimbus, translucent/shaped windows, Java Kernel, and so on) to the previous JDK 7 feature list. And, in light of the news from the JVM Language Summit that Java 7 will include invokedynamic, we can safely add a new JVM with this instruction (and possibly other features for supporting dynamically typed languages).

It seems less certain that Java Media Components and Project Scene Graph will officially debut in JDK 7. I asked Danny Coward to set the record straight:

Q: Will Project Scene Graph and Java Media Components be integrated into core Java starting with JDK 7? Their presence would allow Swing developers to take advantage of keyframe animation, visual effects, and media without having to write code in JavaFX Script. It seems that many Swing developers would prefer to avoid JavaFX.

Danny Coward: We don't know yet if exposing the scene graph and media functionality will make it into the preview for JavaOne 2009; I know there are many developers who would like us to do that. Our top priority this past year was to make the first launch of JavaFX in order to try to attract a new kind of developer to the Java platform and so some of the features are not exposed in the Java programming model (although some others are). There are various backdoor ways to get at it (see Josh Marinacci's blog) for now for the real enthusiasts.
I know that there are some Swing developers who were skeptical about JavaFX ahead of the 1.0 launch, although it's interesting that many of them want to use some of the main concepts of JavaFX like the media and the scene graph. I hope they will try it out now that the SDK is out there before they make a judgment. Remember, it was a Swing developer (Chris Oliver) who created JavaFX Script in order to make creating great looking GUIs much easier, and possible to do for a wider crowd of developers, not just the seasoned Swing experts.

After reading Coward's answer, I started to think that if an API (or some other feature) doesn't appear in the JDK 7 preview at JavaOne, then just maybe the API might get slipped into JDK 7 between then and its final release in 2010:

Q: Can further changes be introduced into JDK 7 after its JavaOne preview and before its 2010 release, or is its feature set considered final at the preview?

Danny Coward: We will likely decide this prior to the preview release of JDK 7 at JavaOne, since we hope to be mostly feature complete for that release so we can get any final issues sorted out before going into the last phase before final release in January. We want to get some feedback on the functionality in JavaFX before we make the call.

In case you missed it, Danny Coward stated that the final release of JDK 7 will arrive in January 2010!

Many developers will probably be excited when the JDK 7 preview hits -- especially fans of NIO2, the Swing Application Framework, or dynamically typed languages. Others will only be mildly interested. For example, I recently asked Cay Horstmann to tell us about the language features and APIs whose additions would get him excited about JDK 7:

Cay Horstmann: I want to see a solution for properties. It isn't sexy, but it is the cause for a large amount of boilerplate, and boilerplate is always bad. Type inference for variable declarations and "multicatch" also reduce boilerplate and would be very welcome. And I'd like to see generics fixed. I really dislike worrying about pitfalls with erasure and boxing, but I don't know enough about the technical details to understand whether a fix is feasible.
A whole slew of, I think, rather misguided little syntax hacks are currently being floated in various polls. Those hacks could be easily expressed in the language if it had closures and operator overloading. I much prefer a small set of strong features over a large set of special rules. As for APIs, I certainly look forward to the Swing App framework and beans binding.
Video support is a must. I also hope that whatever is behind JavaFX is being made available to Java programmers. In the "it ain't gonna happen" department, I fervently wish for an app installer, pen support, additional Swing components, and an editor pane that actually works.

On closures, one of the most controversial subjects of 2008, Horstmann had this to say:

1 2 3 4 Page 3
Page 3 of 4