using Binder in MVP

Generally speaking, when using the MVP pattern with Vaadin, is it usually the Presenter class (rather than the View) that should instantiate the Binder?

It’s not the easiest fit conceptually, but in my opinion Presenter creates and owns the Binder. However, in most cases it makes sense for the View to share custody of the Binder as well, as Binder needs to know about Fields to do the binding and Presenter definitely shouldn’t handle those.

This is strongly opionated topic. In purist sense (no UI classes in Presenter) of MVP View should handle the Binder (if we judge Binder as UI class), and Binder owned by Presenter is actually more of MVC pattern. In the end I think both ways are ok, provided that you are consistent through the whole application.

My thought was that since Presenter has a reference to both the View and Model then it seems to make sense that Presenter should create the Binder. But I do like the purist point of view also. So yes, I see it can go either way and consistency is key. Thanks guys!

We always keep the Binder in the view class and a reference to the bean/model that its binding to in the presenter class. This has worked well for us.