WebML: overcoming UML for web applications
WebML: overcoming UML for web applications
Join the DZone community and get the full member experience.Join For Free
Learn how to add document editing and viewing to your web app on .Net (C#), Node.JS, Java, PHP, Ruby, etc.
WebML was originally developed at Politecnico di Milano, where I have been a student and will still be enrolled in a Master's program of Computer Engineering.
WebML is not a standard, and as far as I know it is supported only by a closed source tool - WebRatio. I am by no means affiliated with WebRatio, which I used in academia during coursework. This article is focused on WebML as a language more than the on infrastructure built around it.
Why yet another modelling language?
UML is the king of modelling languages and its diffusion makes it the only world-class standard for application modelling. I've never encountered a professional developer which did not know how to read UML notation: he may have hated its guts, but still would be able to communicate with UML diagrams on occasion.
The problem with UML is that it is highly generic, and it lacks the semantic for expressing a web application's user experience. UML has specific diagrams like the Class and Object ones which deal the internal of object-oriented applications, but its notation does not contain the concepts of link or database queries.
We have seen approaches (hated more than UML in the Agile community) like Rational Unified Process which used UML stereotypes and diagrams to model web application (UML Web Application Extension). The success of these approaches is dubious - Rational got bought by IBM, but you'll never see a post on UML WAE in 2010.
When a generic language fails to express ideas in a domain, a Domain Specific Language may be introduced. WebML is a language proposal, specific for web applications modelling.
Between the concepts recognized or named by WebML we can find:
- units of computation (database queries or external interactions)
- links between pages and units of computation
- creation of entities and relationships instances
- session management with custom units
- forms, with orthogonal population and data storage.
Here's how a WebML diagram looks like:
I won't go into the details, but we have 5 dynamic pages plus an operation. You can see various recurring patterns captured into units, like entity indexes and data unit to show fields of a selected entity.
Modelling for the sake of it?
I am in good company when I say that I do not believe in the use of modelling languages (like UML) in the large, with the goal of modelling only.
In fact, WebRatio is an Model-Driven Architecture tool, which approach involves generating Java Servlet code from the E/R and WebML user interface models. Hand craft graphical models is not very cost-effective, unless you can generate a great part of your application code from it. MDA is widely disputed in the software development world, being presented everytime as the silver bullet or as a Turing-incomplete language.
In this particular MDA process, complex behavior can be obtained by adding custom components (like payments systems or web services Facade). One of the students which graduated on the same day of mine has developed a demonstrative e-banking application using WebML, with the possibility of transforming it in a real one by inserting Java-based computational units.
What to take away
I am not usually eager to jump on the MDA bandwagon, but in this case WebML made me a better web developer just by improving my user interface modelling skills. Even if we'll choose not to use WebML in an MDA fashion, it will still be useful for building a model for web applications, by constructing an abstraction over HTTP basic element: the document.
WebML can easily be used for modelling instead of UML-WAE diagrams, which are very generic and never feel right (every page has a navigateTo() method. Pages with methods?).
Modelling is not a thing of the past: it is always present in development, when we are writing small pieces of documentation, or try to convey information from one developer to another on a common ground. Just as we sketch UML class diagrams with three or four elements to explain a design pattern, we can explain web design and user experience patterns with WebML diagrams. Back-of-the-napkin modelling is quick and very useful, but still needs a basic language.
I'll never do this again (UML in the large):
But I'll do this quite often (UML in the small):
The same is true for WebML as an abstraction that allows me to show a presentational pattern in a web page.
Maybe in the future when we'll go to the blackboard to discuss a design with other people, we'll have the tool to do so also for the user interface and not only for the data model, which is important in many applications but it's not the most valuable asset.
Opinions expressed by DZone contributors are their own.