The lack of MVP over the MVVM design pattern in android

Hi, I am reading this post https://news.realm.io/news/eric-maxwell-mvc-mvp-and-mvvm-on-android/ , where they explained mvc, mvp, mvvm very well. I understand how the mvp design pattern works.

I do not see a flaw in MVP over MVVM. Because they suggested that this is a problem

Concerts Presenter → Maintenance. Leaders, as well as controllers, tend to collect additional business logic sprinkled over time. At some point, developers often find themselves with large bulky speakers that are hard to beat.

Can someone explain what this means with an example and how it can be resolved using MVVM?

+6
source share
2 answers

I am a big proponent of MVP and have not really tried MVVM. The lack of the ability to get out of hand Presenteris something I have had experience with, but it can be mitigated.

In the post example, the business logic will be relatively simple. There is probably only one model to solve and not too complicated logic.

Think of a more complex example. Say you have an app that sells flowers. Once the user has selected his bunch of flowers, they get to the order parameters screen, where they can:

  • add message to flowers
  • choose a gift vase
  • select postal addresses
  • select delivery date

Then add some domain requirements:

  • you cannot add a message if it delivers abroad

UX, - , Presenter, Model (, , , ) View, Model. . , 500 , .

. UseCase. :

public abstract class UseCase<I, O> {

    public static final int NO_STATUS = -1;

    public Observable<Integer> getStatus() {
        return Observable.just(NO_STATUS);
    }

    public abstract Observable<O> getAction(I input);
}

, , . Presenter View UseCase, Model Presenter View.

Presenter, , .

, Presenter , View Model, - .

+5

MVVP , :

MVVM Android , , +.

MVP MVVP :

  • : MVP . MVVP , .
  • MVP - , . , MVVP ViewModel View ( : D), Data Binding, .
  • Presenter, , .

MVP, , - XML-.

+2

Source: https://habr.com/ru/post/1017017/


All Articles