samedi 2 avril 2016

Presentation Model vs MVP (Passive View)

I'm attempting to learn the Presentation Model pattern, and in my attempt I have become confused in the difference of Presentation Model and MVP - Passive View. Specifically when the Presentation Model does the synchronizing instead of the View. This question is an extension to a previous question on this matter.

Martin Fowler offers the possibilty of the Presentation Model doing the synchronizing Article.

A Presentation Model that references a view generally maintains the synchronization code in the Presentation Model. The resulting view is very dumb. The view contains setters for any state that is dynamic and raises events in response to user actions. The views implement interfaces allowing for easy stubbing when testing the Presentation Model. The Presentation Model will observe the view and respond to events by changing any appropriate state and reloading the entire view. As a result the synchronization code can be easily tested without needing the actual UI class.

If the Presentation Model is synchronizing, I don't fully understand how it is different than MVP(Passive View). His article about Passive View shows an example that uses synchronization to update the view.

So wouldn't a Presentation Model pattern where the Presentation Model references the View (and syncs) be the same as MVP(Passive View)?

Aucun commentaire:

Enregistrer un commentaire