Technical Design Best Practices

Hello all

I’m coming from the GWT world and about to program a fairly big vaadin application for the first time. Therefore I’m interested in design best practices and other tools that might come in handy. And just general advice of course :slight_smile:

  • Using Spring with vaadin: What’s the idea behind this? What do you think, does it help a lot?
  • For what OO-concept would you go: MVC or MVP?
  • Are there particular design patterns which simplify life?
  • Are there other tips you can give me on my way?

Thanks in advance :slight_smile:

ben

How is there no response to this post? :frowning:
These are the exact questions I am struggling with at the moment.

I’ve only discovered the MVP + UiBinder add-on, which seems pretty decent at first glance.

I think it’s really sad there are no straight up examples in the Book of Vaadin. :frowning:

Well it is not an easy question to answer. It’s a bit to ask what is the best pattern in Java, or in programming in general. It depends on the project. Still, it is an important question because there are a lot of bad practices that should be filtered out.

However, things that I value is complete separation of UI code from the backend, With a separate backend you could add on an UI with any technology. I usually then make a set of controllers that bridges the gap between Vaadin and the backend, building containers and whatnot, in a fairly stateless matter. Then the views themselves builds up all the fields and layouts, loads data from the controller and sends commands to the backend via the controller.

That’s just my way for it, and I bet there are as many ways to do it as there are community members here. Please do share how you do it, maybe I’ll learn something as well. :slight_smile:

I think a big reason why people are saying Vaadin develops so much faster is because they’re building really crappy application.
Or rather, they don’t care about loose coupling and just call their applicationservice methods straight from their Vaadin Components.
The thought itself sends shivers down my spine.

We brought in one of our UI experts (he didn’t know a thing about Vaadin) and he advised to use the
Supervising Controller
pattern.

Passive View
was the one I had been thinking of, but after trying out some stuff we found that we were writing way too much boilerplate all the time, which was going to impact our development time pretty much.

So what we did noticed is that Presenters are really easily testable, but the chain can get pretty complicated as well.
Still this choice favores TestFirstDevelopment and it makes everything that much neater.

We also learned a thing or two about Spring’s @Configurable (and I absolutely HATE it), we chose to publish the spring applicationContext through static accessor methods on a helper class. This reminds developers that they should be careful with this usage (much more code and static behaviour needed might get some bells ringing rather then one simple annotation).

Maybe when I have a bunch of spare time left I’ll put some code online that shows what we did.
Something like that would boost Vaadin’s popularity a lot I believe.