Being Productive with Swing

Ben Galbraith, founding blogger at Ajaxian, gave an insightful presentation at JavaOne 2007 on Swing. Ben started off by saying that Swing isn’t in the ‘Wow’ game like WPF, Cocoa, or Flex/Apollo. According to him, JavaFX Script might fill that gap but not just yet. In software development, productivity is king. Productivity is the currency of IT development. According to Ben, the Swing Application Framework does not address productivity but instead focuses on basic architectural concerns.

A theme that I picked up from Ben was that there is too much freedom when working with Swing and everybody builds GUIs in their own fashion. Since there is no consistency in UI development even within a project and since there is no solidified framework, Swing applications are hard to maintain and support.

Basically, there is no opinionated software in Swing to provide a standard, convention over configuration, pattern for building Swing-based applications. The key concerns a Swing framework needs to address are data binding, actions, listeners, activation, consistent form, and life cycle events amongst others.

One invaluable recommendation made by Ben is to use the JGoodies Forms layout if you hand code your UIs. Otherwise stick with your favorite UI Builder. He recommended the UI builder over fidgeting with UI code by hand. He said that coding a UI by hand is like hand writing a 50 page TPS report. He also reminded the audience to not muck or edit generated UI code. Ben said to let the UI builder own the code.

Ben recommended JForm Designer as an excellent commercial GUI builder and NetBeans as an Open Source alternative. Without a UI builder, it is difficult to attain UI consistency while fudging with spacers, fonts, insets, etc. Having a framework helps to attain a consistent layout for you desktop application.

Ben also had time to mention his framework, Swing Clarity. Clarity is a Swing Rich Client Platform that borrows heavily from Ben’s experience as a Ajax/web developer. Clarity has a Prototype-like method, $(), which can find named UI components using CSS-like selectors. With Clarity you can bind behavior to components by the variable name of the component with the help of custom @FormUIField annotation. I will definitely look into this framework as it introduces some ideas that make web development exciting. Clarity also provides bi-directional data binding and allows for some amount of skinning.

As an interesting side note, Ben called Karten Lentzsch, JGoodies project lead, the God father of Swing experts.

Technorati Tags: , , , , , , , ,

One Response to “Being Productive with Swing”

  • anjan bacchu Says:

    hi there,

    useful post.

    TYPO : “Spar also provides di-directional data binding and allows for some amount of skinning.”

    you meant : “bi-directional” ?


Leave a Reply