Tuesday, April 2, 2013

Isis Viewer DHTMLX Preview



In my last post I mentioned the dhtmlx-isis-viewer project, an Apache Isis Viewer based on the DHTMLX component library.
I’ve been busy with other stuff, however thanks to some work provided by “kalifornia girl” and “silver brain” during the week-end, many Emails exchanged with Dan Haywood, PMC chair of Apache Isis Project and hours of late at night hangouts,  I’ve been able to put together a working prototype.
The final result, based on the ToDo application which comes as an example with the Isis framework distribution,  is hosted on the Google App Engine and available at http://isis-viewer-dhtmlx.appspot.com/ (until it does not run out of FREE quota).
The application is very simple to use.
A couple of details about the specific features of the Isis framework and the dhtmlx-viewer: lists provide the default behavior by double-clicking on a row, the right-click displays a pop-up menu with the list of the available actions enabled or disabled depending of the context.
A similar thing happens for the buttons available on a ToDoItem detail view.
The application includes more sophisticated functions, like the upload of an attachment stored as a blob in the Google App Engine datastore.
The Ajax contribution given by the DHTMLX component library results in a minimal browser-to-server communication within a single HTML page.
For those who are not familiar with Isis and are asking what is so interesting in this application, the answer is very simple : the user interface is *almost* completely generated by the viewer.
I used the expression *almost* on purpose, because each project has a one or more use cases that requires a custom user interface that is very hard, if not impossible, to generate automatically.
The ability to provide some type of customization to the automatic UI generation has been a the subject of many discussions within the Naked Object pattern community, in which Isis is a Java implementation of the NO pattern.
In the dhtmlx-isis-viewer approach a specific zero-learning-curve DSL (Domain Specific Language) has been designed to process the automatic generated user interface and apply the customization.
Due to the fact that in the early stage of my career I was involved in many project of compilers or interpreter (the good old time of C, Yacc and Lex) I took the opportunity to enjoy the powerful features offered by ANTLR4.
You can take a look at an example of the DSL opening a detail view of any ToDo item and clicking on the View DSL button on the top right corner.
The prototype gives the ability to edit the DSL code in place, submit the changes clicking the Run button and immediately see the result.
Keep in mind that only the detail view contains DSL code, for some reason it is not possible to add DSL code to the other automatically generated views at this  time.
In order to give the opportunity to play with the code the changes are stored in the session and are deleted when your session expires.
That said, I’m pretty sure the DSL code looks very familiar to any experienced DHTMLX developer however, even for the more skeptic it takes a while to understand what it does.
It is possible to change which properties are displayed, the order of presentation, put actions on a toolbar buttons, display a collections  of related objects, etc.
I will provide additional details about the feature of the DSL in another post hopefully next week, in the meantime it is possible to play the *what-if* game creating any crazy-user combination and, if you play hard, completely crash the viewer; but don’t take it bad, it is just a prototype.
If, for any reason, someone is interested to develop a custom language to solve a specific problem, I strongly recommend the Martin Fowler/Rebecca ParsonsDomain Specific Languages” book, which contains an extensive coverage on the topic and also illustrates in detail the advantages and drawbacks of creating DSLs.
Where the DSL does not provide enough power to satisfy the requirements, the dhtmlx-isis-viewer provides on the client side the code-hooks that allows developers to reference the UI components and write the ad-hoc customization.
If you are interested you can check out the 10 slides presentation below.


One more thing, the dhtmlx-isis-viewer trailer includes the SAMCRO experience.
If you want to try this feature you need the following recipe:


  1. Grab a Cup of Coffee.
  2. Call your best friend asking five minutes of their time.
  3. Select for example a not Yet Complete ToDoItem from the list.
  4. Ask your best friend to select the same item and perform the 'Complete' action.
  5. If you are lucky, you should get a real time message and the updated data.


Technical details on SAMCRO are available here.
The primary objective of the prototype was to evaluate the feasibility and complexity of the project, the resulting 3400 LOC (without any refactoring and duplication removal) seems to be very promising in satisfying the major requirement in keeping the project small.

Thanks must go to Marcius Brandão and colleagues for their prior work on a Naked Objects View Language for originally developing this idea.
Feel free to give feedback. Any contribution is welcome.
In the next post I will go into deeper details, stay tuned










No comments:

Post a Comment