Hi,
I come from a ZK background, so that definitely colours my suggestion here. By and large, I find Vaadin more productive, in some cases significantly. However, there is one area that I really think is weak in Vaadin’s programming model.
That is the Listener concept: e.g. component.addListener (…code… or interface implementation).
In ZK to handle an button event for example, you have a public method like this:
public void onClick$<item name>()
{
// Handle event details here...
}
I know there are a couple of addons for Vaadin that do this
, but I think this is a good candidate for inclusion into the core.
There reasons I feel strongly about this are:
- Less coding, the current Listener only approach takes much more code to achieve the same
- Implementing the listener for onClick for example, handles ALL buttons = more complex event logic
- I personally really dislike anonymous inner classes, OK my hang up
On the 3rd point, guilty as charged, largely because I spent years fighting with Swing and finally giving it up in favour of SWT. So esthetically and in terms of volume of code to maintain I really don’t like inner classes. It makes code harder to maintain and the UI logic is scattered through lots of snippets of code.
Good OO design generally discourages Inner classes. I tend to design one class = one java file, I know Vaadin makes extensive use of inner classes, which I personally do not like, but I’ll live with it I find explaining the concept of inner classes to someone who is new to OO very long winded. From a coding point of view, they add no logic or informational value at all and possibly create more confusion. So I personally never use them. Again, my design choice.
That being said, anonymous inner classes
may
also impose a slightly greater performance hit on the JVM (at least they did when I last looked at this kind of thing some years back).
See this thread on
Stackoverflow
and may have memory and security leaks:
Any seasoned developer will dread taking over someone else’s code because of finding so much spaghetti code. I’ve done this on quite a few large projects and it is really, really, really nasty.
I think the ZK concept is much cleaner, much easier for a new developer to pick and far, far more maintainable. The only “downsde” is each component you want to have an event handler for must have a unique ID. They then automatically auto-wire the calls from the button, for example, to the on$ that handles it.
I’m not starting a ZK vs Vaadin flame here, both a very good in different areas (I’m writing this in a Vaadin forum, hint, hint )but any successful project can learn from another.
The main reason I’m focusing two new projects on Vaadin is frankly the much, much better handling of themes and the ability to style systematically components. I know the same can be done in ZK, but it is not as rigorous as Vaadin.
Anyway, that’s my 2 cents worth.
Thanks again for producing an amazing product.
Anthony