Hello, Welcome back to the XUL Titan Interview series. Today let's welcome SwixNG project lead Michael Klaus.
Q: Can you tell us a little bit about yourself? Michael Klaus: I'm a contract developer focusing on the redesign of non-visual applications and components. Having started programming at the age of seven, I got into the IT sector short after finishing school. My professional career started in hotline support, went over maintaining a DBase IV application, and then into customizing content management systems for several bigger companies. This was the time, about five years ago, that Java got my attention and never gave it back. During the past years as a contract developer, I then focused primarily on the backend side of large information systems. Q: How did you stumble onto the SwiXml library? Michael Klaus: It was at the end of my last creative break I'm taking every other year. I wanted to get into Java 1.5 by porting some KDE applications, and needed a replacement for the QT XUL to make it all-Java. SwiXml impressed me immediately with its compactness and intriguing powerful internal design. Q: How did you get started on SwixNG? Can you tell us a little bit about SwixNG's history? Michael Klaus: When I first imported SwiXml into Eclipse, the ugly yellow warning signs got me to work a bit on the code. I removed the MacOS support (didn't like the platform dependence and code overhead it introduced) and in the run ported the engine from JDOM to the integrated JAXP parser. At this time, I was too much into changing the code to stop - so I just went on. SwixNG was there before I even noticed what I had done. Alas, the SwiXml developer(s) didn't seem to like it, so I took a chance and released it myself. And now, maintaining it is more work and much more fun than I'd ever anticipated. Q: Can you briefly sketch out SwixNG's architecture and its building blocks? Michael Klaus: SwixNG consists of the core engine (which is in fact just an enhanced de-serialization mechanism) and two working modules for Swing and TableLayout support. The core engine takes care of includes/Plug-in handling, constants, references and custom attribute parsing. Additionally, it enables localization and object hierarchy support. SwixNG_Swing configures this engine to support many Swing objects. Most of this works with the reflection mechanism provided by the core, so the code is relatively small. SwixNG_TableLayout adds support for this really neat LayoutManager. It's close to nothing in terms of code size. Both modules give you a good idea on how to integrate your components with the engine. The full distribution additionally contains a JGoodies module which is, in my opinion, not working yet. I couldn't tell a user interface from a desk lamp, so this is a part where the project greatly depends on feedback and contributions *hint hint* Q: Can you tell us how you handle the mapping from XML tags/attributes to Swing classes/properties? Do you use reflection? Do you use hand-coded glue code? Michael Klaus: I'd call it augmented reflection, a mechanism that lets you decide if and how to use reflection in your mapping. This provides for ease-of-use and the flexibility the users need. Have to give credit to Wolf Paulus and SwiXml at this point :o) Tags are mapped through an explicit mapping of a tag-name to a TagHandler (or simply the class if you don't need to augment). This mapping is done by SwixNG_Swing automatically to provide for a quick start. The core provides full reflection support for constructors, public fields and setter methods. To support additional, virtual attributes, the Swing module either provides them in a subclass of the component, or for more complex cases handles them in a subclass of DefaultTagHandler. Also, unhandled attributes are used to enable ButtonGroups or apply UserProperties. Support for "add" methods still requires to create custom Appenders. That's subject to change during the next weeks. Q: Can you tell us some challenges you faced creating a toolkit that lets you create Swing UIs using XML? Michael Klaus: I started from the SwiXml code base, so it was really easy as I always had something that worked at any point in time. The real challenges were the decisions on what to modify: port to JDK 1.5, remove MacOS and so on. Also, I wanted to keep the mechanisms as compatible to SwiXml as possible, while giving the users more freedom and ease of use as they dig deeper into the system. Getting this all managed without sacrificing the rest of my life was - and is - a real challenge. Q: What's the hook? Why would anyone use SwixNG over say good old Java Swing coding? Michael Klaus: Code size, maintainability, speed of development. Just to name a few. I always hated how you have to create your components, and then append them to the parent container somewhere down in the code. This is not how GUIs look like in the end, thus not a natural way to define them. XML as a markup language is much closer to the final result. SwixNG_Swing provides for very small, highly interactive applications. Especially if you face to build a larger system with Plug-in support and localization, or if you can see the need of international hotline support, you may want to try it. If your application is less ambitious, you also can reduce code size greatly. SwixNG is applied in 2 lines of code, and the delegates are a short and flexible replacement for Actions or ActionListeners. Q: Can you tell us what layout options SwixNG supports? Michael Klaus: Right now, it supports FlowLayout, BorderLayout, GridLayout, CardLayout, GridBagLayout and TableLayout. SpringLayout and FormLayout, although frequently requested, are not yet supported because of the complexity of the constraints. Will take some time and probably experts for the respective LayoutManagers to make them work. Q: Do you have any plans of adding web-style form submission tags to SwixNG? What's your recommended approach for data-binding for SwixNG? Michael Klaus: The idea of enabling HTML-like, simplified design indeed crossed my mind. It's not exactly on my wish list for the next version, but there sure is a need for this in bigger teams. The solution will probably not be integrated into the Swing module itself, but as an add-on to that. To the data binding, I'm for sure the last person you want to ask for a recommendation in this matter ;o) SwixNG_Swing lets you access all of your components in an easy way, so any approach you can use on plain Swing should work alike. Q: What's your take on adding CSS support to SwixNG for styling using rules? Michael Klaus: This goes much with the HTML idea from above. Both are features that feel "unnatural" for a Swing coder, but make it much easier for GUI/interaction designers. A fitting solution may include some other technologies (XSLT comes to mind) . But yes, CSS support will most likely come in future. Q: Do you have a favorite scripting language for the Java runtime? Any plans for adding support for scripting to SwixNG? Michael Klaus: I have only used BSF for fun so far, and with very little success. For real, I prefer using plain Java and maybe a dynamically compiling ClassLoader for this purpose. There are no plans to include scripting into SwixNG at the moment, but the users are out there. Whatever they need, they get. The only limitation I'm putting on this is, it will have to be in a separate module, as there are people who prefer to have a small system without too many external dependencies. Q: Any plans of supporting different UI toolkits such as SWT, wx4j or Java Gnome, for example? Or do you plan to stick to Swing? Michael Klaus: Sticking to one toolkit is a limitation I do not want to put on the users, and the engine is already prepared to support about any toolkit out there. At the moment, there are plans to at least add support for SWT and AWT in near future. Q: Any plans of turning the SwixNG kernel into an all-purpose Java to XML mapping tool? Michael Klaus: It already is, at least in terms of de-serialization. The core will not provide a serialization in future. But I could imagine it as a separate tool to ease porting of existing GUIs. Q: Can you tell us how popular SwixNG is? (e.g. How many downloads? Can you highlight some applications using SwixNG? etc.) How can someone get involved in core SwixNG development? Michael Klaus: The download counter at Sourceforge seems to be broken at the moment, so I have no idea how many people have tried SwixNG. At least two people are already evaluating it for their projects. Intriguing, if you take into account that SwixNG has not even finished its second month on earth. Getting involved into the project is easier than many people may think: give feedback! A simple mail about what you like or dislike about the system helps greatly to improve it. A second step would be to get involved in the discussion forums and the project's IRC channel at freenode. Also, the Bug-, Support-, Feature- and Patchtracker on the Sourceforge site are all set up and just wait to be used. A project newsgroup at gmane is being worked on and will hopefully be online at the time this interview is published. Q: Any plans for SwixNG? What's next? Michael Klaus: Version 0.3 will probably be more of a maintenance release. Documentation and Samples will have to be enhanced to provide more help, and the occasional bug has to be fixed. Also, users request a documentation for the XML files used by SwixNG, so I'll be trying to provide a usable mechanism as soon as possible. In fact, it's hard to create a roadmap for a product you neither use professionally, nor have exact specifications for. It's the users who will decide which features need to come, and when. Thanks Michael Klaus. Links: * SwixNG - http://swixng.sourceforge.net * SwixML and SwixNG Developers Group - http://groups.yahoo.com/group/swixml ______________________________________ XUL News Wire - http://xulnews.com XUL Alliance - http://xulalliance.org ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ xul-announce mailing list xul-announce@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xul-announce