lundi 6 mars 2017

Why move to MVP from MVC

I currently using the MVC design pattern in the Android application. But recently explore about MVP. It found pretty interesting to me.

I find some useful example to differentiate between MVP and MVC let me show them here.

Actual MVC:- enter image description here

What we follow in Android Application:- enter image description here

How MVP behaves:- enter image description here

In MVP we are introducing a presenter as a middle man and making our ViewController which is fragment/Activity in our case as dumb as possible because in Android View and ViewController are tightly coupled with each other.

But my question is that before even knowing MVP we used to make helper class for all the fragment and activity which are now converted in Presenter in MVP design pattern.It helps in keep code clean and maintainable. So, what makes MVP better than MVC if I am having the helper class for all ViewController and diverting BL in these helper class.

I also read MVP is better in TDD but I already following TDD in MVC and able to get more than 60% code coverage, so how MVP is better to work with TDD rather than MVC.

Aucun commentaire:

Enregistrer un commentaire