This is a bit of a difficult one at the moment. It seems MVP is the flavour of the month (or year, as it were) but there are so many options available and very few actual tutorials.
There are also numerous frameworks out there but most people seem to want to use "the google way" if possible. I'm going to give http://code.google.com/p/gwt-platform/ a go because it looks like it has some great docs, and that'[s what google is lacking at the moment.
The point is, there are no good TUTORIALS available - that's how we will all actually understand. The Stockwatcher tutorial on gwt was really useful, we could do with more like it. Here's some tidbits I've found:
I use GWTP because it is reasonably well documented, easy to understand and has an active user community. When I started learning the framework I had to ask a couple of questions in the forums and on both occasions, I got a friendly and helpful response on the same day from one of the authors.
1. Those working on the MODEL abide by the ServiceAync Interface
2. Those working on the view creates the User Interface and returns the
specified control to the presenter according the program interface defined by
their respective presenter
3. And Finally those working on the presenter level defines an interface which
the view has to implement
我认为其中可能出现的主要问题是当视图、模型或演示者之一不遵守接口时
I think the best technique of MVP for GWT is to have the following classes
Model
View
Presenter
And make the view and the presenter interacts through a defined interface and have the presenter fetch data from the model. First, it is very simple, secondly it allows team working since we are using interfaces, every teams just have to abide by the interface.
For e.g.
1. Those working on the MODEL abide by the ServiceAync Interface
2. Those working on the view creates the User Interface and returns the
specified control to the presenter according the program interface defined by
their respective presenter
3. And Finally those working on the presenter level defines an interface which
the view has to implement
I think that the main problem that can arise in this is when one part which may be one of the View,the Model or the Presenter doesn't abide by the interface
Seems see GWT frameworks are a dime a dozen, much like Java web frameworks. That being said, I went with 4. Primarily because I wanted to do MVP without the boilerplate interfaces:
I tried GWTP but it doesn't everything under the hood without you understanding it and it is hard to diverge from there way of doing things. I had this issue the first time I tried it and I tried it again too. Unfortunately, I had the same issue. I wanted to combine the Presenter and View for 1 page because it was overkill for that page. Unfortunately, I couldn't figure out how to do that so I decided that my worst fears had been realized. It's very hard to diverge from their way of doing things in GWTP. The architecture of GWT 2.1 is much more decoupled. I hadan issue with the ActivityMapper though. Now I'm looking at mvp4g.
发布评论
评论(8)
目前这有点困难。 MVP 似乎是本月(或年度)的风潮,但可用的选项太多,而实际的教程却很少。
我浏览了“联系人”示例并有点明白了:
http://code.google.com/webtoolkit/articles/mvp-architecture.html
然后我意识到他们在 2.1 中添加了“活动”和“地点”,所以我查看了该示例:
http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
还有许多框架,但如果可能的话,大多数人似乎想使用“谷歌方式”。我将提供 http://code.google.com/p/gwt-platform/ 尝试一下,因为它看起来有一些很棒的文档,而这正是谷歌目前所缺乏的。
关键是,没有好的教程 - 这就是我们真正理解的方式。关于 gwt 的 Stockwatcher 教程非常有用,我们可以做更多类似的事情。以下是我发现的一些花絮:
This is a bit of a difficult one at the moment. It seems MVP is the flavour of the month (or year, as it were) but there are so many options available and very few actual tutorials.
I went through the Contacts example and kinda got it:
http://code.google.com/webtoolkit/articles/mvp-architecture.html
Then I realised they had added Activities and Places in 2.1, so I looked at that example:
http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
There are also numerous frameworks out there but most people seem to want to use "the google way" if possible. I'm going to give http://code.google.com/p/gwt-platform/ a go because it looks like it has some great docs, and that'[s what google is lacking at the moment.
The point is, there are no good TUTORIALS available - that's how we will all actually understand. The Stockwatcher tutorial on gwt was really useful, we could do with more like it. Here's some tidbits I've found:
我使用 GWTP 是因为它有相当完善的文档、易于理解并且拥有活跃的用户社区。当我开始学习这个框架时,我不得不在论坛上问几个问题,在这两种情况下,我在同一天都得到了一位作者友好且有帮助的答复。
I use GWTP because it is reasonably well documented, easy to understand and has an active user community. When I started learning the framework I had to ask a couple of questions in the forums and on both occasions, I got a friendly and helpful response on the same day from one of the authors.
我认为 MVP for GWT 的最佳技术是拥有以下类
并让视图和 Presenter 通过定义的接口进行交互,并让 Presenter 从模型中获取数据。首先,它非常简单,其次它允许团队合作,因为我们使用接口,每个团队只需要遵守接口即可。
例如,
我认为其中可能出现的主要问题是当视图、模型或演示者之一不遵守接口时
I think the best technique of MVP for GWT is to have the following classes
And make the view and the presenter interacts through a defined interface and have the presenter fetch data from the model. First, it is very simple, secondly it allows team working since we are using interfaces, every teams just have to abide by the interface.
For e.g.
I think that the main problem that can arise in this is when one part which may be one of the View,the Model or the Presenter doesn't abide by the interface
新版本的 GWT (GWT 2.1) 引入了 MVP 框架,
他们引入了一些新术语,例如:
您可以在此处查看详细信息:
http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
The new version of GWT (GWT 2.1) introduced an MVP framework,
they introduced some new terminology like:
you can check the details here:
http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
看起来 GWT 框架比比皆是,很像 Java Web 框架。话虽这么说,我选择了 4。主要是因为我想在没有样板接口的情况下实现 MVP:
http:// www.gwtmpv.org/view Generation.html
文档一如既往地简洁,但如果您有任何问题请联系我,我很乐意回答。
gwt-pectin 也很好——我认为 gwtmpv 更简洁,但是 gwt-pectin 已经做了丰富的模型/绑定到视图方法一段时间了。
Seems see GWT frameworks are a dime a dozen, much like Java web frameworks. That being said, I went with 4. Primarily because I wanted to do MVP without the boilerplate interfaces:
http://www.gwtmpv.org/viewgeneration.html
Docs are light, as always, but ping me if you have any questions, I'd be glad to answer them.
gwt-pectin is good too--I think gwtmpv is more succinct, but gwt-pectin has been doing the rich model/bound to a view approach for awhile.
同样使用内置 MVP 框架,幸运的是,当使用 Spring Roo GWT 时,所有样板代码都会为您生成。
Also using the built-in MVP framework, luckily when using Spring Roo GWT, all that boilerplate code is generated for you.
对我来说,它是 GWTP,一个完整的模型-视图-呈现器框架,可以简化您的下一个 GWT 项目。可以在
http://code.google.com/p/gwt-platform/
For me its GWTP, a complete model-view-presenter framework to simplify your next GWT project. available at
http://code.google.com/p/gwt-platform/
我尝试过 GWTP,但如果你不理解它,它并不能解决所有问题,而且很难偏离这种做事方式。我第一次尝试时遇到了这个问题,我也尝试了一遍。不幸的是,我也遇到了同样的问题。我想将演示者和视图合并到一页,因为这对于该页面来说是多余的。不幸的是,我不知道该怎么做,所以我决定我最担心的事情已经成为现实。很难改变他们在 GWTP 中的做事方式。 GWT 2.1 的架构更加解耦。我遇到问题ActivityMapper 不过。现在我正在看mvp4g。
I tried GWTP but it doesn't everything under the hood without you understanding it and it is hard to diverge from there way of doing things. I had this issue the first time I tried it and I tried it again too. Unfortunately, I had the same issue. I wanted to combine the Presenter and View for 1 page because it was overkill for that page. Unfortunately, I couldn't figure out how to do that so I decided that my worst fears had been realized. It's very hard to diverge from their way of doing things in GWTP. The architecture of GWT 2.1 is much more decoupled. I hadan issue with the ActivityMapper though. Now I'm looking at mvp4g.