MVP模式(GWT)的优点是什么
我刚刚阅读了这篇文章,它确实令人困惑我很多。
其次,这个模型允许我们最大限度地减少 GWTTestCase 的使用,它依赖于浏览器的存在,并且对于我们的大部分代码,编写轻量级(快速)JRE 测试(不需要浏览器) )。 [1]
这就是全部好处吗?我有遵循这种设计模式吗?这似乎使代码变得更加复杂......你使用这种模式吗?
I just read this article and it did confuse me a lot.
Secondly, this model allows us to minimize our use of GWTTestCase, which relies on the presence of a browser, and, for the bulk of our code, write lightweight (and fast) JRE tests (which don't require a browser). [1]
Is this the whole benefit, I have from following this design pattern? It seems to make the code more complex... Do you use this pattern?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不得不不同意,MVP 使代码变得不那么复杂,尤其是在 GWT 的情况下。如果您计划开展中型到大型 GWT 项目,那么 MVP 架构是您的主要选择。我建议查看 GWT MVP(由 Google 提供)和 gwt-platform(由 KennethJ 建议)。还有其他实现。
MVP 的主要优点(我的意思是 MVP 模式 - 不仅仅是 GWT MVP):
业务逻辑;你所有的客户端
Java 代码变得极其通用
对 GWT 的依赖性最小
实施(主要通过
接口)。这有助于测试
巨大但无价
UI设计本身的好处。
逻辑
有限的 GWT 依赖项
您可能采用的其他补充技术:
I have to disagree, MVP makes code way less complex, especially in case of GWT. If you plan on medium to large size GWT project then MVP architecture is your primary option. I suggest to look at both GWT MVP (by Google) and at gwt-platform (suggested by KennethJ). There are other implementations as well.
MVP's main benefits (I mean MVP pattern - not just GWT MVP):
business logic; all your client side
Java code becomes extremely generic
with minimal dependency on GWT
implementation (primarily via
interfaces). This helps tests
tremendously but it's invaluable
benefit of UI design by itself.
logic
limited GWT dependencies
Other complementing technologies that you are likely to adopt:
相比之下优势是什么?
主要原因
如果您的意思是与标准 MVC 模式(UI 开发的常见模式)相比的优势,那么是的,我想这就是该模式GWTTestCases 比标准 junit 测试慢得多且麻烦得多的 。您希望使用标准 java 测试框架来测试逻辑,并使用 GWTTestCase 仅测试 UI 特定逻辑。
advantage compared to what?
if you mean advantage compared to standard MVC pattern (the common pattern for UI development), then yes, I guess that's the main reason for this pattern
GWTTestCases are far slower and cumbersome than standard junit tests. You'd want to test the logic using standard java testing frameworks and use GWTTestCase to test only UI specific logic.