14

The question is self explanatory, just to add my thoughts :
As far as I have read, The presentation layer in Clean arch has the same responsibility as in MV in MVP.

How one decides to choose one pattern instead of the other?

1
16

What Bob Martin called "Clean Architecture" is more a "meta architecture", a high level guideline for creating layered architectures. It does not say anything like

"There must be a Model layer, a View layer and a Presentation layer, and they must be implemented using MVP",

it contains only more general rules for the layers like "dependencies must go from the outer circles to the inner circles, not vice versa". And since in MVP, the View (=UI) might know the Presenter, but the Presenter is decoupled from the View by an interface, MVP is just one of many possible solutions which fulfills this rule.

Of course, one can use MVP inside a "Clean Architecture" system, but this is not the only one correct approach. Any UI design where the "inner layers" do not know anything special about the UI, and where the UI follows also the other "Clean Architecture" rules described in Bob Martin's article will be fine.

2
  • if I follow MVP pattern, is it guaranteed that I haven't violated Clean architecture rules? – Mehrdad Shokri Nov 24 '16 at 11:44
  • 1
    @Mehrdad: no. MVP just helps you to get the "Dependency Rule" right, and only between the layers View & Presenter, as well as between Presenter and Model, no less, no more. You still have to care for all the other things described in Bob Martin's article. For example, MVP alone does not stop anyone from passing complex data structures between layers (as opposed to the simple data structures mentioned in that article which should be used for crossing boundaries). – Doc Brown Nov 24 '16 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.