We are about to begin development on an application that will eventually require both a web based UI and a graphical UI. I'd like to know of others' experience in this area.
Is it possible to develop a UI from a single "source" that takes full advantage of a graphical interface and also scales down elegently to a web UI? I would certainly want to avoid maintaining two completely separate user interfaces, but I have my doubts. At the very least, I would like to know of any ideas in maximizing code and resource reuse between the two UIs. If I am forced to maintain two UIs for the same product, at least let me keep as much code the same between the two as possible.
Any ideas, suggestions, resources, or patterns are greatly appreciated.
Why dont you go for Applets which are rich in UI and provide the same look and feel as HTML(Depends on on's UI capability). You will def'ly be reusing 90% of your UI code
I think you mean an applet looks the same as an application...
Why the need for 2 GUIs at all? We went with a web application only and the customers are lining up.
A good way to have 2 UIs would be web services (SOAP).
Generate XML which can be requested by anything.
The UI will only be responsible for showing the data contained in the XML and preparing new XML to send back to the business tier.
The UI can be either a very think Swing/SWT/AWT application, a servlet (using possibly XSLT to render HTML or WML on the fly), a C# or VB.NET applet on a PDA or whatever.
All your relevant code is never duplicated, except for maybe a bit of clientside validation routines and a stub of your SOAP handler (which you can reuse as well if you make it a separate class as you should).
The Swing and HTML/XSL code are of course not interchangable, those will always have to be maintained in parallel (though you might be able to generate XSL scripts to generate both Swing code (Java) AND XSLT/HTML code from the same sources, but that would effectively mean writing a new programming language and compiler from scratch which is really only effective if the project is expected to become HUGE and has a very high rate of change in existing code.
Why dont you try with WebOnSwing? it's just what you are looking for.
You can share exactly the same code in both contexts, first develope the swing application and then you just apply some html templates for compose the web view.