Thanks for your wonderful and pioneering work on MVP in android.
Having gone through your implementation, I found out that there is a direct coupling between View and Model in Line 48 of MainActivity.class, which is not advisable in MVP pattern. I later realized that this was not written originally like this, but later added as a workaround to avoid using reflection in the unit testing of MainPresenterTest.class.
To resolve both of the above issues, I refactored the code using Dependency Injection with Dagger 2 and used MainActivity.class as the composition root along with Fragment to handle the view. I also revised the MainPresenterTest.class to test the same five predefined tests without reflection.
I think the code is now even clearer to read and understand, thanks to your original prominent work.
Thanks for this, but I don't want to add Dagger in this repo. This needs to be as simple as possible so that people who don't know about MVP can understand it. Dagger is too complex.
Thanks for your wonderful and pioneering work on MVP in android. Having gone through your implementation, I found out that there is a direct coupling between View and Model in Line 48 of
MainActivity.class
, which is not advisable in MVP pattern. I later realized that this was not written originally like this, but later added as a workaround to avoid using reflection in the unit testing ofMainPresenterTest.class
. To resolve both of the above issues, I refactored the code using Dependency Injection with Dagger 2 and usedMainActivity.class
as the composition root along with Fragment to handle the view. I also revised theMainPresenterTest.class
to test the same five predefined tests without reflection. I think the code is now even clearer to read and understand, thanks to your original prominent work.