search

Home  >  Q&A  >  body text

android - MVP模式 包的结构

就包的结构
我看到过两种

结构一


结构二

model view presenter是按模块分类比较好,还是写在一起比较好?
还有,是不是小项目用了mvp反而显得麻烦?
谢谢!

黄舟黄舟2772 days ago642

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-17 17:33:53

    First of all, I always think that MVP will become dirty if the business is complicated.
    For example: Your business needs to do something before initiating a request, something needs to be done after the request responds, and finally something needs to be done for error handling. Then a business needs to write 4 interfaces. MVP业务复杂的话会变得很脏。
    比如: 你一个业务发起请求前需要做一些事,请求响应后需要做一些事,最后错误处理还要做一些事,那么一个业务需要写4个接口。

    其次,Presenter

    Secondly, Presenter is business-related, not page-related.

    Finally, it is a design pattern idea. There is no need to be strict about the package structure, just do whatever you like. 🎜

    reply
    0
  • PHPz

    PHPz2017-04-17 17:33:53

    Personal understanding:
    1. Divide by business module
    2. Within the business module, divide MVP
    3. Of course, you need base, common, etc. dependencies

    reply
    0
  • Cancelreply