Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

额……关于MVP模式的一些疑问 #9

Closed
lwlizhe opened this issue Mar 16, 2018 · 2 comments
Closed

额……关于MVP模式的一些疑问 #9

lwlizhe opened this issue Mar 16, 2018 · 2 comments

Comments

@lwlizhe
Copy link

lwlizhe commented Mar 16, 2018

理论上mvp模式是这么规定的:

作为一种新的模式,MVP与MVC有着一个重大的区别:在MVP中View并不直接使用Model,它们之间的通信是通过Presenter (MVC中的Controller)来进行的,所有的交互都发生在Presenter内部,而在MVC中View会直接从Model中读取数据而不是通过 Controller。

但是在拜读代码的时候发现BaseMVPCompatActivity这个类(这个类是否是view层呢)中,发现有model……(initData方法中通过mPresenter.getModel()获得了model)

按照mvp的设计模式,view层不应该出现model吧……

所以想请教下设计思路……

@Horrarndoo
Copy link
Owner

(ヾノ꒪ཫ꒪) 感谢指出!由于MVP的Base类是很久之前写的,后面写这个项目的时候直接就拿着用了。当时写的时候可能没有注意到这个,后续会尽快修正这个问题。

@Horrarndoo
Copy link
Owner

@lwlizhe 最新代码已修复这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants