In your add-on I like the fact that it’s really simple (in my opinion the most important thing). But I’ve got the feeling that a lot of code will be in Presenter. For example for a form with a pojo, the model will be fairly simple, the view will also be simple and will have actions, binder, validators, …
So (as Tatu Lund suggested), would MVVM be better in this case?
I think you should not create a MVP because it’s a common pattern (which one MVP) but to solve a problem. As you may have different problem, you may use different pattern.
Well I guess this depends on the answer to: “What is better some (frontend-)pattern or no pattern at all?” to which I guess there is no general answer, since it depends a lot on the Usecase. But my solutions does not force the user to use a pattern. Maybe this could also be seen as a way to make the user actually think about their usecase. Since Java also provides interfaces for some general patterns as well so why not providing some in Vaadin?
Tatu Lund:
With Vaadin 10+ you can implement your application by MVC/MVP pattern equally well than you did it with Vaadin 8. The structure is not enforced by the framework, but neither it is having anything that makes it impossible.
Maybe supporting was not the proper wording, I meant supporting in the way of helping (reducing boilerplate). Not in the way that the frameworks hinders the user. So yes Vaadin does not hinder the user in using common patterns, but it also does not encourage the user.
since Vaadin as a framework is somewhat agnostic what comes to this kind application level questions.
But why is it being agnostic about this? Doesn’t the UX (user being the developer) suffer from this?
Since every user of Vaadin has the “problem” in finding a fitting pattern, one could argue since the framework does not help the user, this will lead to more boiler plate. Some users might not even be interested in finding a proper pattern for their application, these users might be writing bad code.
Providing some basic structure (as an example can be seen in the addon) for the most common patterns, could be a way to reduce boilerplate code, and possibly help the “uninterested” user in writing better code.
When using templates (with Designer or other means) the MVVM (Model View View-Model) pattern is becoming more natural i.e. View being the template and View-Model the Java side implementation.
As this topic is opionated and there is no absolute thruth which pattern is the best (and that is why frameworks in general should be agnostic to this), my recommendation usually is that, select a pattern that fits your application and be consistent with it.
Ofcourse you got a point there is no holy grail in the frontend pattern department, but this is not what this is about. This is more about development comfort and how it could be improved. You might also be right that MVVM might be the better choice here.