Tuesday, November 11, 2008

On GWT GUI and pure POJO applications
(no DB code, no GUI code)

http://code.google.com/p/kiyaa/wiki/TemplateSystem
http://code.google.com/p/google-web-toolkit-incubator/wiki/UiBinder

OK, I passed through many doubts, leaps and revelations while working with GWT generators to make the GUI creation simpler. I have been creating GUIs for more than 10 years now, from Delphi of borland. Though the usage of widgets might be inevitable, why not GUI creation be just a POJO with annotation (and some minimal API if needed)? After 2-3 years now EJB realizes it can be.

For GUI the key is to separate 4 things: CSS for style, HTML for layout, POJO for logic, and widgets binding underneath to POJO data types. GWT recognizes this clearly. CSS and HTML is very popular and pretty good in what it does.

For logic, on any day, GUI widgets can grow and should, and all the while even smallest of programming language has data types that are richer than what you can show on GUI. So GUI should be best done as a program over the attributes/properties/variables with no direct reference to gui and its properties.

Finally to make all things link up, we need the data types mapped to the widgets, some standard and allow escape routes to create new widget for new or old data types.

So it boils down to a good set of GUI neutral pojo-property annotations, that makes sense in java and has enough hints for GUI.

If this stage is reached, emboldened by hibernate/JPA effort to do the same for db, we can then aim to have the same POJO to work in server and for GUI with all its bells and whistle. Of course RPC should be possible with minimal hints as GWT has already showed it possible with elegance. Like public/private/protected we may need new modifiers or annotations might be just enough. That is while creating the pojo, annotate which has to go to client, and which will be persisted and also which will be shown in GUI and how!

Think of that, a full blown application in all its glory (performance and capabilities) just as a properly done collection of objects, and every aspect highly configurable.

Of course Ruby on rails does this (mmmm... maybe that is it? If only it had java in backend and GWT in front ;). I also saw ACE of sun sometime back but it looks dead now.
http://research.sun.com/projects/ace/

Nothing new as an inherent interest of all, but destination looks incredibly close now. If GWT believes, it can do it radically soon. Maybe think this way, take POJO, apply JPA annotation to it, and now add new GWT GUI (ideally generic standard) annotations to it. Create HTML and run GWT over it. Presto. RPC, html binding all taken care of.

GWT can keep adding to the standard data type mapping, and allow custom routes for experts.

In this light declarative UI looks bit out dated (?!) because maybe component binding will become a less common daily chore.

1 comment:

senthil said...
This comment has been removed by the author.