示例1-MVP

来源:互联网 发布:花椒网络直播 编辑:程序博客网 时间:2024/06/15 09:17
MVP与MVC
MVP(Model View Presenter)
MVP模式3要素:
     (1) View :负责绘制UI元素、与用户进行交互(在Android中体现为Activity); View通过View interface与Presenter进行交互,降低耦合,方便进行单元测试; 
     (2) Model :负责存储、检索、操纵数据(有时也实现一个Model interface用来降低耦合); 

     (3) Presenter :作为View与Model交互的中间纽带,处理与用户交互的逻辑。 

      

MVC模式3要素:
     (1)View:对应于布局文件
     (2)Model:业务逻辑和实体模型
     (3)Controllor:对应于Activity



参考:

http://antonioleiva.com/mvp-android

https://github.com/pedrovgs/EffectiveAndroidUI

https://github.com/konmik/konmik.github.io/wiki/Introduction-to-Model-View-Presenter-on-Android


0 0
原创粉丝点击