GWT 最佳实践 - MVP
这是向所有 GWT 专家提出的问题。
我是 GWT 的新手,正在尝试了解编写 GWT 应用程序的最佳实践。我已经完成了基于 Ray 的“大规模应用程序开发和 MVP” Ryan 在 Google I/O 2009 上的演讲给了我一个很好的起点。我还根据列出的最佳实践下载了联系人应用程序的示例源代码。
与示例“联系人”应用程序相比,我尝试使用 GWT 开发的应用程序要大一些(就涉及的模块而言)。所以我想把它分成多个功能。
我一直在读到,在 GWT 应用程序中拥有一个入口点是一个好主意,而且我不想将所有代码转储到一个 AppController 类和应用程序中。一个 RpcService,在这种情况下最好的方法是什么?
我将如何将控制分派给多个控制器?有没有办法使用 GWT 框架中的一些类来实现这一点?
A question for all the GWT gurus out there.
I'm a newbie in GWT and am trying to understand the best practices of coding a GWT application. I have gone through "Large scale application development and MVP" based on Ray Ryan's talk at Google I/O 2009 and it has given me a good starting point. I downloaded the sample source code as well for the Contacts application based on the best practices listed.
The application I'm trying to develop using GWT is a bit bigger (in terms of the modules involved) when compared to the sample "Contacts" application & so I want to split it up into multiple functions.
I have been reading that having a single Entry point in a GWT application is a good idea, and I don't want to dump all the code in one single AppController class & one single RpcService, what would be the best approach in this situation?
How would I go about dispatching the control to multiple controllers? Is there a way to achieve this using some classes in the GWT framework?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于大型 GWT 应用程序,可以使用像 GWTP 这样的框架(它是 gwt-presenter 和 gwt-dispatch) 几乎是必要的。它提供了诸如用于处理位置/历史记录的 Places、方便的 Presenter 框架、EventBus 和非常简单的代码分割等功能。
For large GWT apps, a framework like GWTP (which is a fork of gwt-presenter and gwt-dispatch) is almost necessary. It provides things like Places for handling location/history, a handy Presenter framework, EventBus, and really simple codesplitting.
如果您正在开发非常大的应用程序,那么请将您的应用程序拆分为多个模块。
对于客户端 MVC 模式,我建议 PureMVC。
http://puremvc.org/
If you are developing very big application then split your application into multiple modules.
For client side MVC pattern I suggest PureMVC.
http://puremvc.org/
如果您担心初始加载大小并且可以以不同的块加载大型应用程序,请考虑 代码分割
If you're worried about initial load size and it's possible to load your big app in different chunks, consider Code Splitting