Android MVP with new Architecture Components
Quang Nguyen

Excellent article, I like how you use Repository with your existing MVP architecture without changing its essence, I would like to add somethings here.

After going through the Architecture components, I have an impression that its more like modified MVP(with Interactors aka Use Cases) where ViewModels act as Presenters, Repository acts as Interactors. We already had MVP libraries which included lifecycle aware behaviour for Presenters, e.g subscribeView() and unsubscribeView(), now that we have this as part of Arch components library, I think we can leverage this and get rid of code where we explicitly attach and detach View from Presenter, having said that I also think that BasePresenter can extend ViewModel and we can do cleanup and initialisation work there. I am currently looking into how to integrate Lifecycle components and ViewModels with grace into existing MVP frameworks.

Another great thing from Arch components is that RxJava and LiveData can work together and it can be a very powerful combination, right now there’s a lot of confusion surrounding this, there’s no uniform way to convert one form to another e.g. zip observables etc, but I am sure we will have something in the future.

One thing I’m not a fan of is the fact that the Google Arch components example on Github has business logic at View level, I think that can use some influence from MVP.

Like what you read? Give Arif Nadeem a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.