如果“演示者”是正在“视图”上设置属性这是否违反了 MVP 模式?
我是 MVP 的新手,正在尝试了解情况。
我陷入了困境:
为了能够在我的视图上进行更多单元测试,我还想将一些属性设置转移到 PRESENTER。这样我就可以查看某些视图属性是否已设置并且设置是否正确。
但此时我的第六感正在对我低声耳语,我开始怀疑我这样做是否打破了 MVP 模式。因为对我来说,这听起来更像是“设置”而不是“呈现”:(
那么,如果“演示者”在“视图”上设置属性,是否违反了 MVP 模式?
谢谢
I am new to MVP and trying to get the picture.
And I am stucked at one point:
In order to be able to unit-test more on my View, I would like to also shift some property settings to PRESENTER. So that I can see if some View properties are set and also set properly.
But at this point my 6th sense is whispering me quite noisy that I started to doubt if I am breaking MVP pattern by doing this. Because it sounds like "setting" more than "presenting" to me :(
So, if "Presenter" is setting a Property on the "View" is it a violation of MVP Pattern?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 MVP 中,Presenter 应该设置 View 的属性。您可能会想到 MVC,其中控制器只负责向视图传递对模型的引用。在 MVP 中,Presenter 通常与 View 紧密相关,并负责直接设置属性。
In MVP the Presenter is supposed to set properties on the View. You may be thinking of MVC where the Controller is simply responsible for handing the View a reference to the Model. In MVP the Presenter is typically pretty tightly tied to the View and responsible for directly setting properites.