I’ve been programming in Java for about 13 years now, and I’ve becoming more and more convinced that there should be a much easier way to create GUI applications than writing Java code.
This might sound like a strange statement, especially coming from a huge Java fan like me.
I see teams struggle daily to build GUIs. Not because Swing or SWT/RCP is bad -these are two great UI frameworks- but just because such a lot of code must be written. The code is also not necessarily the most inspiring kind of code; there are only so many ways that you can write data-binding code using JFace data-binding, or do layouts doing GridLayout (try using FormLayout: much more fun).
Good GUI applications are difficult to write (in my view much more difficult than your typical server-side code), but - and this is the thing to think about - about 80% of the code should “just happen”. (Some people might call this the scaffolding code or donkey code).
Over the years I started searching for this elusive technology that will help me make this 80% of the GUI code “just happen”. I want to think about my domain, practice some good domain-driven development, and then blink my eyes and the GUI must be there. Then I can spend the rest of project doing the more difficult 20% of the code...
What an adventure it is to search for this Holy Grail in the software world...
One’s journey will perhaps start off with one of the most obvious first quests to go for (and in some development environments the only available quest...): the visual designer/builder/drag&dropping tool.
A next quest might lead you to the highest peaks of UI DSLs. Technologies like Glimmer, Gryphon, XScalaWT, ScalaSWT, XWT, etc.
No adventure would be complete without a quest into the dungeons of code generation tools, like spring-roo, but for the Desktop GUI world. XText is an exciting project in this and the DSL realm that warrants some exploration.
The deepest of the dungeons might reveal code generators that actually generate XML... perhaps a XML-based UI DSL, like XWT. But XML always begs the question: is it fit for human consumption? What if something does go wrong with the tooling, would you want to go and hack UI code in XML?
Back to the Basics...
In this adventure, as I went from quest to quest in search of that illusive technology, I came to realise: probably the most important part of the GUI development process is a basic foundation of good practices and principles, to be applied no matter what technology you are using.
And the first of these core principles: do not become bogged down with a particular GUI technology.
Java offer a wide eco-system of technologies that play together very nicely. You do not even have to know Java to code great Java-based GUIs. Try out different approaches, different technologies. I know I’ve been playing very hard with various options, so I can avoid working hard writing donkey code.
PS: I’m presenting a one-day workshop on this topic on the 8th of September in Worcester, South Africa (near Cape Town). We’ll look at typical frustrations and issues with GUI development, explore UI DSLs hands-on (yes, even straying away from Java in the process...), play with XText, talk about practices and principles, and generally have a lot of fun.
More info here.
Subscribe to:
Post Comments (Atom)

1 comments:
I`m a noob, but a good noob at java. I have a question. Witch are the steps in designing GUI? And I ask this from the code side, like:
1 - make JFrame
2 - make JPanel`s in JFrame
3 - make arrange JPanel`s as according to your layout.
4 - make objects....JButton, JTextPane..
and so on.
Thx in advance.
P.S. Sorry for my bad english, not native language.
Post a Comment