使用Google Web Toolkit(GWT)的Model-View-Presenter [英] Model-View-Presenter with Google Web Toolkit (GWT)

查看:137
本文介绍了使用Google Web Toolkit(GWT)的Model-View-Presenter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用web工具包开发一个新的应用程序。我决定最好的选择是使用模型 - 视图 - 演示者设计模式。在做了大量的研究之后,我发现了两种不同的实现框架代码的方法。 (我仍然试图学习MVP,以及如何最好地利用模型和视图之间的分离)。

以下是讨论GWT MVP的两个链接。



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



我仔细阅读并理解了第二个链接中的所有信息,如何将演示者与视图相关联,以及如何进行自定义事件等。我真的很喜欢这个,因为这意味着一些开发人员将能够开展我想要的项目。不过,第一个链接也指出了一些有趣的东西,主要是使用XML和@UiBinder等等。我觉得这些对于这个特定的应用程序来说不是必需的,但我想确保我没有忽视任何东西。

基本上 - 编程练习的好处在于第二个链接中的样式(每个视图都有演示者)。

谢谢

解决方案

您应该不会比较 MVPActivitiesAndPlaces MVP 。如果您不关心浏览器历史记录管理,请仅使用 MVP


  1. 活动和场所对MVP不是强制性的。它们只允许您清理浏览器历史管理,并将其与MVP体系结构很好地集成在一起。

    UiBinder 对于MVP不是强制性的。他们可以与MVP一起使用。
  2. MVP设计范例大多是以单元测试作为主要驱动因素来驱动的,并尽可能避免缓慢运行GWTTestCase。





这个模式的核心是把功能分成逻辑上合理的
组件,但在GWT的情况下,为了使
最小化我们对GWTTestCase的依赖并减少
运行测试的整体时间,我们清楚地关注使
a尽可能简单。



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

解决方案

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.

这篇关于使用Google Web Toolkit(GWT)的Model-View-Presenter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆