sockeqwe / mosby

A Model-View-Presenter / Model-View-Intent library for modern Android apps
http://hannesdorfmann.com/mosby/
Apache License 2.0
5.49k stars 841 forks source link

MviView #209

Closed charbgr closed 7 years ago

charbgr commented 7 years ago

Should we consider to create a new MviView interface for the MVI module and not use the MvpView one?

My thoughts are all about for separation of concerns and scalability. For example, in an MviView, we can force to have a render method with a ViewState.

I can go for it and make a PR.

Let me know what do you think.

sockeqwe commented 7 years ago

I would prefer to keep Mosby very slim. I don't want to push people to have exactly one render() method, that would be very framework-ish and I see Mosby more as a little library. I would like to see that people can use Mosby as a library to build their own "framework a like" architecture on top of it if they want to.

For example, if someone prefers calling view.showLoading(), view.showContent()from Presenter this is still possible inMviBasePresenter`.

interface MyView extends MvpView {
    public void showLoading();
    public void showData(Foo foo);
}

class MyPresenter extends MviBasePresenter<MyView, MyModel>{

   protected void bindIntents(){
        ...
       Observable<MyModel> observable = ... ;
       subscribeViewState( observable, { view, model -> 
              if (model.isLoading()) 
                  view.showLoading();
             else 
                  view.showData(model.getData);
        }
   }
}

I don't want to limit people. Freedom is quite important for me and the driver of innovation / evolution.

So I'm open to discuss this with the community, but from my point of view it doesn't make much sense to limit people and therefore I don't see a good reason to introduce a MviView

Btw. you could introduce a MviView with a render() method just for your project.

dimsuz commented 7 years ago

I agree with @sockeqwe. In a few project I work on we have developed our own mini-framework of classes on top of basic stuff provided by Mosby. Mosby is good because it is focused on this and doesn't get in the way. It is nice when you have simple, working and stable bare defaults which you can use to build something more custom on top. Extensions can be provided as different modules/libraries, but the core should stay focused imo.

sockeqwe commented 7 years ago

I think we agree that this is something a user of Mosby should do on top of Mosby. If not, feel free to reopen this issue