Swing, RIA and JavaFX – interview with Mikael Grev

May 22nd, 2008

A fighter pilot by day and a professional Swing developer by night. Meet Mikael Grev as the interview series on Swing, RIA and JavaFX that started with Amy Fowler continues.

Tell us a little bit about yourself.

Mikael Grev pictureI’m a geek and a fighter pilot. A strange and peculiar combination, I know, but it is true nevertheless. The duality was there from the beginning, playing Ice Hockey six days a week (against Peter Forsberg and Marcus Naslund no less) and coding demos on the Commodore 64/ Amiga the rest of the time.. My day job is in the Swedish Air Force, where I am an instructor on the Gripen fighter aircraft. All other time I run MiG InfoCom AB, a small consulting company. Married to an understanding wife, obviously no children. I would be surprised if your audience was interested in my military carrer, so I’ll leave that be :). When it comes to coding I have created Wing, a flight planning, coordination and evaluation system in use by the Swedish and Danish Air Force. I have also created MiG Calendar (and the site) which is the best selling Java component at the largest online reseller, ComponentSource. MiG Layout is my latest project. It is a FOSS (BSD) Layout Manager for both Swing and SWT that promises to put the fun back in hand coding GUIs… I am also quite proud of MiG Base64. Very geeky but fun for a performance freak like me.

You’re writing open-source and commercial Swing components primarily oriented at business applications. How do you think Swing fares as compared to competing toolkits, such as MFC, Delphi, GTK, Cocoa, QT and others?

In general, pretty well. I find the famous comparison to a instrument panel of a Boeing 747 particularly amusing, and accurate. If you know what you are doing it is extensible to the extreme. As a newbie, however, you can find yourself spending hours doing the simplest of customizations. The other frameworks are generally simpler and less configurable. Either what you want to do is easy or not possible at all. Much of the complexity in Swing comes from the IMO bad architectural choice to extend the AWT base classes for the Swing components and the lack of properties.

Other UI toolkits seem to have much larger variety of professional third-party component suites. Amy Fowler attributes this to the rise of web applications, but it didn’t seem to affect the market of Delphi and .NET components. What are your thoughts?

In Swing it is very easy to write simple components but very hard to write complex ones. Especially those that interact with other components during design-time. The support for having non-trivial properties is a nightmare and I have seen few other components than MiG Calendar that actually bothers with complex property editors. The reason is that the JavaBean spec is still at version 1.01 and has never been revised. There is a lot of trial-and-error when touching the outer parts of the spec since it is written in a very loose and open ended way. The problem with this flexibility is that it is interpreted in different ways by the different component container (IDE) vendors. Flexibility is often good, but here a more pragmatic approach would have been better, in retrospect. Since I have worked a lot with Swing, writing the actual components was not the hardest part, that was to make them work properly in all the IDEs. Especially the code->deploy->test-in-IDE- workflow is painful, time consuming and error prone. Without JFormDesigner I don’t think I would actually have made it.

JSR-273, where I am on the Expert Group, set out to firm up the JavaBean spec and provide for a better interface to components, especially under design-time. Unfortunately Sun was not interested in driving it to finnish. My conclusion is that Sun is not interested in a Swing component market.

In short, complex components are time consuming to create, hard to test in its target environment, and without a good channel to sell it. I also miss a good way to support licensing of the component within the IDE. VisualStudio, for instance, has direct suport for this.

What do you think about Sun’s new direction of client Java towards RIA space with JavaFX?

I have mixed emotions. Another layer? Hiding something under another layer is seldom good, unless you make that layer so darn good that you never have to see the plumbing beneath. If Sun release it prematurely, or force the developer to jump down to the Swing level all the time, it can turn ugly fast. Sun has little goodwill they can ride when it comes to desktop matters, JavaFX better be perfect when released or the complain-a-lots will blog it to death.

It is paramount that all demos coming out of Sun looks absolutely stunning. The need to be at least as good as the Silverlight and Flash/Flex/Air demos, probably even better since they are the under dog. When looking at The new JavaFX site I’m uncertain that the Sun hired designers are up to snuff. At least to me it looks, well… you know… but taste differs.

I would probably have put my money in a non-backwards compatible complete Swing overhaul (called SwingIT!) where real properties, translucency, animation, binding and all that fancy stuff was built in from scratch. On top of that I would have built the tools that the designers could use. I sometimes wonder who JavaFX Script is for? Designers won’t touch it for sure and I don’t feel like I as a Swing developer would gain anything, except maybe for prototyping or small cool effects applets (where Flash is king anyway).

What worries me the most about JavaFX is that they are still using the really, well… quality challenged… Swing layout managers. Primarily not because of the actual layout managers, but because the JavaFX architects don’t seem to understand what the the real problems are. Even now when they have the chance to start with a clean slate, they start new with old stuff that never worked that good. But… Time will tell. Maybe I’m just getting old and don’t want my Swing magic wand to loose its swinging power. :)

Are you planning to wrap your components for easier consumption in JavaFX applications?

To be honest I don’t know. Probably. Since it hasn’t been released I have too little information about the work needed to make a business decision. But if our customers want it, or JavaFX takes off like Sun think it will, I will do it for sure. I have been working a lot with GWT as of late and I actually like it, a lot. One cool, very AJAXy, interactive charting component, coming up!!

Can Swing be considered a premier choice for cross-platform UI development today? Would you recommend Swing for building large long-term business applications?

I get this question a lot and I never know what to answer. Or maybe more accurately, there is no short answer.. If you have good developers that have the time to put themselves properly in the know about Swing it is a good toolkit to use. Even more so if the app really needs to be cross platform. Most of Swing’s old problems are gone now. Performance and appearance have reached the level where they are no longer a problem. Though you can never just throw Swing at a large team of developers and let them have at it. Disaster would follow. A Swing project needs to be properly researched in advance to keep clear of the cavets. For instance, if you start using NetBeans and Matisse, which are both formidable tools in themselves, you have forever locked your team into that IDE when it comes to the GUI, and they are smarter than I am if they can alter the created GUI code by hand.. With proper research and initial study Swing can be recommended.

Would you want to see your products folded into the core JDK distribution, and why?

Yes I would. MiG Layout would help a lot of Java developers create good looking GUIs without them even thinking about it. White space and such are just handled automatically. Having MiG layout in the JDK would make it available to millions of developers compared to maybe 1% of that if it is kept outside as today. Only a fraction of the Java developers actually makes the effort to search the net for alternatives. Some don’t because they expect the best of breed to be included in the JDK and some because of the extra external dependency it would bring to the project. MiG Layout is now #14 at the TOP 25 RFE list and climbing fast. I know of no other official way to influence Sun in these matters, so why not cast a vote or two on it? (or three..)

Is there anything else you would like to add?

Pulling 9G:s I look just like my grandfather and my heart looks like a banana. ;)