Posted by eitan
on December 3, 2004 at 8:20 AM PST
..or: Our Love/Hate Relationship with Swing
I finally got around to read about JDNC (http://jdnc.dev.java.net/ ), to download a copy, run through the demos, look at the .jdnc files, and read some of the documentation (tutorials, article, etc..) I am very impressed! I think JDNC is terrific. I mean its goal is right on target. I believe this is where efforts should be concentrated. And they finally are.
This blog was originally going to be about JDNC but in the course of writing, I've discovered that JDNC is more of a derivative, a consequence of a more fundamental issue regarding most developers' our love/hate affair with Swing.
I think it's fair to say that many of us have a love/hate affair with swing. many of us have been burned by the love affair and are now hateful. others have been more cafeful not to get so emotionally involved in this relationship.
Back to the love(/hate) affair: I believe that I can finally express in writing the reasons why:
We love Swing because Swing has the right foundation. I mean Swing's design is good:
- it can be extended
- it's flexible
- it allows for the construction of other components besides the ones that come with Swing
- it allows for the construction of more sophisticated components,
- it allows for frameworks to come after it and layer themselves between swing and, say, markup developers
There exist already a number of frameworks such as thinlets, certain xul implementations, and now jdnc that allow developers to use markup to build guis. under the hood they all use swing.
so, bottom line: swing is good
Now let's talk about the hate part. the hate part comes when we commit to the relationship and try to tango with swing. Some of us are, after some difficulty, able to build the front-ends of our business applications with Swing. The relationship requires a strong investment, lots of time and effort. For many of us, the relationship doesn't work out.
The reason is now clear to most of us. They happen to be detailed quite clearly in Amy Fowler's overview article on JDNC (https://jdnc.dev.java.net/documentation/overview.html ).
The fact that Swing has a great design and is extensible is great. It's the right foundation and we all agree. It's interesting to point out that even web frameworks (e.g. JSF) are attempting to give web development that swing-like design. One example is the ability to register an event listener on an input component, such as a button.
But there's a large and gaping hole, there's a gap between Swing and our jobs of building front-ends for business applications. It may be fair to say that Swing's job was never to provide all the tools that a developer might need for that task. And that's why I'm happy to see JDNC on the scene. Finally there's a project to address this situation: fill in the layers necessary to bridge the gap.
The JDNC team has identified the layers. There is a need for more sophisticated components such as sortable tables, date pickers and much more. They're working on them and a number of these components already exist in JDNC. Then there's the idea of allowing one to use markup to build a UI. So JDNC provides code that will parse xml markup and automatically translate that markup to code that will construct the ui for you. All the while, it's Swing code running under the hood.
The state of JDNC:
JDNC is not yet complete. The current version I believe is 0.6. They have a roadmap published. Check it out. I think that by this time next year, the equation of which way to go to build an app will have to be revised slightly. Make no mistake about it: the effort is asking for help from the community. I believe that help from the community can make a difference between a successful project and one that does not achieve significant adoption.
Note: JDNC is LGPL. So it's open source. What that means to me is that I sincerely hope to see code contributions from non-Sun employees folded back into the codebase.
Another thing that I think needs to happen that could help the adoption of the project is: its name!
I know that JDNC is a product of the javadesktop.org community so the name's got to have "Java Desktop" in it. Then, ok, you might want to bind the widgets to data from a web service over the network, so they threw in "Network" and, of course, we're dealing with providing a suite of components such as the data-bound tables, treetables, date pickers, etc.. so there we have it: Java Desktop Network Components.
Maybe some additional brainstorming needs to go into a good name that quickly conveys the project's purpose to the community. I wonder how many people may be passing over JDNC because they don't realize what problems the project is addressing.
More on JDNC
For those of us who have been waiting for a long time for a serious effort to make swing a simpler, more viable alternative for building business front-ends, we can finally say that it's now happening.
We're getting all the goodies we've been wanting. New and higher level components such as date pickers and treetables. Improved components sporting features such as sorting and filtering; addressing issues such as data binding and validation mechanisms; easy construction of UIs using XML (optional!).
I'll say it again: this is impressive and right on target. I really think this is the kind of stuff we need. So, I'm looking forward to seeing JDNC maturing over the next year. The roadmap document says that v1.0 might be ready around the Fall of 2005.
One item I am eagerly looking forward to is samples or a tutorial for using JDNC components directly from a Java Swing application; that is, without using the xml markup language. This is not to belittle that effort. Not at all. I think that's an awesome and cool feature of JDNC that should not be discounted. I just happen to be more interested in the former at the moment and find the JDNC documentation in that area a little lacking at the present time.
Keep up the great work. Thank you for working on this stuff. If you haven't seen the JDNC demos, you should definitely check them out. They're simple and to the point.
I see a number of developments going on in the Swing world at the moment. Here are some of them:
Spring Rich-Client (subproject of the Spring framework)
TableLayout (I think TableLayout should be part of J2SE)
There are of course some really nice goodies in J2SE 5.0 including print support for tables. Spring Rich-Client appears to be an effort similar to JDNC but independent from it. I wonder if one might gain dominance over the course of the coming year. I mean Spring and Hibernate came out of nowhere and are now the bread and butter of software development. Will Spring Rich-Client be able to follow in their success? We'll have to revisit this one in six months to a year.