Skip to content

MVC 和 MVP #1

Description

@jeezliu

Controller 负责翻译并沟通 Model 和 View,完成 Model 到 View 世界的映射,业务逻辑主要包括:
获取并处理用户的输入(拦截校验、预处理等);V => C
将输入处理转换为 Model 层可接收理解的语义,发送给 Model 处理(增删改查);C <=> M
将对数据的操作结果,转为View 层可接收的语义,发送给 View 显示更新。C => V
Presenter 产生原因,Activity 不容易隔离 Controller 和 View,MVP 拆分 Activity 的功能,使其对应一个View (直接作为View 或包含 Fragment),对应一个 Presenter。
Presenter 的提出是为了强调进一步解耦 View 和 Model。如果Controller 完全隔离 View 和 Model,两者功能上没有区别。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions