开发者

"Presenter First" vs "Passive View" MVP?

开发者 https://www.devze.com 2022-12-23 15:42 出处:网络
Is the \"Presenter First\"开发者_C百科 MVP pattern the same as the \"Passive View\"?If not, how do they differ?Maybe i\'m wrong, but from what i understand :

Is the "Presenter First"开发者_C百科 MVP pattern the same as the "Passive View"? If not, how do they differ?


Maybe i'm wrong, but from what i understand :

The mvp pattern used in presenter first approach is a slight variation around the passive view described by martin fowler. In some case, when the business object (or model) is too hard to map directly on the view, they use an adapter class between the presenter and the view. The adapter is responsible for translating a complex object into some trivial types used by the dumb final view.

Ex: The presenter have to deal with a PersonList model. The view is made of a grid. The Presenter pass the model object directly to the adapter (that take the role of the view) and the adapter translate it into cells, rows, columns and vice versa.

For a very simple object to map on a view, i think it's a pure passive view MVP pattern like fowler's one.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号