The Model in MVP - Events

扶醉桌前 提交于 2019-12-23 04:39:13

问题


I have a layered architecture as follows;

Presentation
Service
Business
Data

If I implement MVP for the presentation my understanding is that the Service Layer represents the 'M' i.e. model, is my understanding correct? If so from my interpretation of MVP the model can raise events which my presenters would subscribe to. Does this mean that my service layer would raise events?

UPDATED

This question has been viewed a number of times but has not attracted any comments or answers, if there is something wrong with the question please comment as I would like to get an answer on this. Thanks.


回答1:


The basic idea behind the View Presenter portion of a MVP design is that view is lightweight. Much of the logic that folks put into the form and controls reside in the Presenter. The Presenter is the grand central station of the design. Retrieving the data, updating the model, and raising events to let the other areas of the application know that something has changed. The model is mostly focuses on the storage and retrieval of the desired data.

The key question in using MVP design is what happens if I rip off Forms X and replace it with Forms Y? If you find yourself making radical changes to the presenter to reflect the new UI then likely it not a clean MVP design.



来源:https://stackoverflow.com/questions/1996433/the-model-in-mvp-events

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!