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:
- I use the smart-presenter-dumb-view modification of the MVP.
- A view is a router that implements a View interface, let’s say EditCustomerView, the implementation is EditCustomerViewImpl.
- The view is connected to the presenter (I prefer controller name because that’s what that is) through Spring dependency injection.
- 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.
- 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
- 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.
- Avoids view knowing anything about the nitty gritty details of the domain and the backend.
- Easily patternised.
Hope this helps.