Posted by evanx
on August 4, 2008 at 3:57 PM PDT
We gonna consider the definition and evolution of computer UI. But first, what is a computer? It's a number crunching machine that interfaces to a human being, innit. Actually, "data crud'ing" is probably a better depiction than "number crunching" in the world of business information systems.
An Irrelevant Aside on Irrevence and Metaphysics
But let's back up a bit! Computers are created by man, for man. We're told that God created the world, and God created man, who created computers. But who created this "God," this incredible leverager of physics, creator of nature, lover of life, guider of conscience?
Many scientists believe there is no God. They have an unshakeable faith in the laws of physics, which they desperately strive to understand fully and properly, without approximation or simplification. One might say they believe in God without realising it - depending on what God is, which we don't know, but whose DNA might be glimpsed in the undiscovered unified theory of the universe?
But what has this got to do with computers? Well, maybe God is an AI - an unbelievably massive computer, existing on a scale too small and at the same time too large, too intrisic and too extraneous for us to fathom? Maybe our Big Bang and our Universe was created by an AI from another universe in other dimensions, who went into "God-mode"? Yeeaah baby!
The Evolution of UI
Let's consider the evolution of the computer UI...
UI 0.0 - Punch cards and big buttons to press eg. "Execute Program,"
and flashing lights.
UI 0.1 - Character-based terminals with a "submit" button (see also Web 1.0)
UI 0.2 - Character-based terminals with key-typed events
UI 0.3 - Rich Graphical Client/Server Applications (see also RIA)
UI 1.0 - Web 1.0 - HTML forms with a "submit" button
UI 2.0 - Web 2.0 - AJAX
UI 3.0 - Rich Internet Applications - Laszlo, Flex, JavaFX - consuming web services
The UI of the Internet is the Web, whose simple "hypertext" exposed and exploded the Internet into humanity's information network.
We know that applets didn't succeed initiallly as expected. Now Sun is breathing new life into applets with JavaFX and the Java6 update10 plugin, rather than concede to Flex et al, and we hope that client-side Java will enjoy a resurgence of sorts, as a competitive RIA platform?
So what's the UI vibe? I mean, what's the problem and what solutions we got? Firstly, let's separate the UI into logical MVC components, and label them the UI-view (visual), UI-controller (logic), and UI-model (data).
The problem with UI programming is that we gotta construct a UI-view, and respond to UI events in the UI-controller. Web applications might use DHTML to construct the UI-view, while Swing and some other toolkits, including Web ones like Wicket and Echo, assemble a component tree.
The UI-view is clearly a visual thing, and so i (as in me myself and i) think it should be built using a visual WYSIWYG tool ie. a UI builder!? Whether it's an HTML UI, Flex or Swing GUI, it doesn't matter! Use Netbeans, FlexBuilder or whatever to create the visual aspects of the UI - problem solved, silver bullet loaded, safety on!
On the Swing side of the coin, we create listeners and SwingWorkers and what-not in our UI-controller. Also we wanna bind our components to UI-model beans, with validation 'cos users occassionally bash the wrong keys, heh heh!
Web programming vs Swing
So is "web programming" easier than Swing RIA programming? Who knows!? Firstly "web programming" is a very broad term, 'cos there's a mountain of available options, eg. GWT, Wicket, and also JSF/Seam which seems to be an emerging standard of sorts for JEE?
Firstly assuming that the UI-view is always constructed using a UI builder, then we don't have to write any code for the UI-view, just drag and drop. So there's no difference in coding difficulty between various approaches for the UI-view 'cos there is no coding! (Having said that, UI builder's may not be available yet for some toolkits?)
Secondly let's assume that in the web approach, we use frameworks to automate and simplify everything as far as possible, eg. using AOP, convention-over-configuration, annotations, injection, binding and validation, eg. JEE/EJB3/Seam.
Given the above, i would say that Swing programming is more tedious than Web programming!? 'Cos Swing is quite low-level stuff - we gotta create listeners, register them, create workers, runners, and what-not. We have fine-grained control over the GUI, but we pay handsomely for that, D'oh! We aint got no convention-over-configuration, and we aint got no AOP.
Swing's pain points
So what are the pain points of stock-standard Java/Swing GUI programming, as opposed to other languages on the JVM with Swing bindings and builders and what-not? And can we anesthetise that pain?
Surely one option is something like the JavaSwingBuilder , where we define the Swing UI using markup, and our framework constructs the GUI, and conveniently wires up our event handlers and what-not. But what if we wish to use the Netbeans' GUI builder to design our UI-views?!
Arguably a problem is the "low-level" plumbing and boilerplate, for events, background vs EDT threads, and beans eg. firing property changed events.
So can't we eliminate boilerplate code from Swing as far as possible, using annotations, AOP, convention-over-configuration, eg. for beans binding, events and tasks? Then how would Java/Swing RIA programming stack up against Flex, JSF/Seam, etcetera? As my aging aunt says, "Who knows!?" ;)
https://code.google.com/p/vellum/ - where i will collate these articles and their code.