Clean Architecture Application with Vaadin Flow

There seems to me that there are as many ways to talk about architecture as the ways to implement it. So here is how I do it:

  1. I use the smart-presenter-dumb-view modification of the MVP.
  2. A view is a router that implements a View interface, let’s say EditCustomerView, the implementation is EditCustomerViewImpl.
  3. The view is connected to the presenter (I prefer controller name because that’s what that is) through Spring dependency injection.
  4. The only thing the view does with the controller instance is a) call controller.attach(this) in the constructor and controller.run() on router attach.
  5. The smart controller registers listeners to the events with the new, and drives the view content in response on user’s actions.

What I like about this approach is it

  1. Follows the best OOP/OOD practices where dependencies are interfaces, both IoC and DI. This makes it easy to evolve the controllers and views, and easy to test.
  2. Avoids view knowing anything about the nitty gritty details of the domain and the backend.
  3. Easily patternised.

Hope this helps.