Model-View-Presenter with Google Web Toolkit (GWT)

不打扰是莪最后的温柔 提交于 2019-12-24 10:56:03

问题


I am thinking about developing a new application using web toolkit. I decided that the best option is going to be to use the Model-View-Presenter Design Pattern. After doing plenty of research, I found two different ways of implementing the skeleton code. (I am still trying to learn MVP and how to best utilize the disjunction between the model and the view)

Here are the two links discussing GWT MVP

https://developers.google.com/web-toolkit/doc/latest/DevGuideMvpActivitiesAndPlaces https://developers.google.com/web-toolkit/articles/mvp-architecture

I read through and understand all the information in the second link, how you associate presenters with views, and how you have your custom events and such. I really like this because this means that several developers will be able to work on the project I have in mind.

However, the first link, also points out some interesting stuff, mostly using XML and @UiBinder and other things. I feel that those will not be necessary for this particular application but I want to make sure I have not overlooked anything.

Basically - How good of a programming practice is the style the style in the second link (the one with presenters for each view)

Thank you


回答1:


You should be not be comparing MVPActivitiesAndPlaces and MVP . If browser history management is not your concern use only MVP.

  1. Activities And Places are not mandatory for MVP. They only allow you clean browser history management which integrates nicely with MVP architecture.

  2. UiBinder is not mandatory for MVP. They can be used with MVP.

  3. The MVP design paradigm mostly is driven with Unit testing as main driver and to keep out slow running GWTTestCase out as much as possible.

At the heart of this pattern is the separation of functionality into components that logically make sense, but in the case of GWT there is a clear focus on making the view as simple as possible in order to minimize our reliance on GWTTestCase and reduce the overall time spent running tests.



来源:https://stackoverflow.com/questions/15193909/model-view-presenter-with-google-web-toolkit-gwt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!