Question concerning MVP

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question concerning MVP

James Howe
I've been poking around the Dolphin implementation of MVP a bit in an
attempt to understand a bit more about how it works.  One thing which sort
of confuses me about MVP is the fact that most, but not all, view resources
are defined on Presenters, but there are a handful of views which define
their own view.  I'm not quite sure why this is the case.  For example,
PushButton is a view, but has several view resources associated with it.  
To get a push button, you get a resource off of the view.  However
something like CardContainer has no views and to get one you ask Presenter.
 I'm not quite sure what the rationale is for having a Presenter define a
view resource in a situation where it would seem like you would just get
one directly from the view itself.

Can someone explain this?

Thanks

--
James Howe


Reply | Threaded
Open this post in threaded view
|

Re: Question concerning MVP

Andy Bower-2
James,

> I've been poking around the Dolphin implementation of MVP a bit in an
> attempt to understand a bit more about how it works.  One thing which sort
> of confuses me about MVP is the fact that most, but not all, view
resources
> are defined on Presenters, but there are a handful of views which define
> their own view.  I'm not quite sure why this is the case.  For example,
> PushButton is a view, but has several view resources associated with it.
> To get a Push button, you get a resource off of the view.  However
> something like CardContainer has no views and to get one you ask
Presenter.
>  I'm not quite sure what the rationale is for having a Presenter define a
> view resource in a situation where it would seem like you would just get
> one directly from the view itself.

The answer to this is fairly straightforward; it is simply that a view
resource is generally associated with an appropriate presenter if there is
one available.  If there isn't then the resource gets attached to the view
instead.  For example, in the case of PushButton, there isn't an appropriate
presenter class because push buttons are merely command sources and never
appear as part of the presenter framework.  Like Menus, PushButtons only
ever appear in views.  In the case of CardContainer then this can sensibly
be associated with the Presenter class because very often a presenter
instance will be connected with the container view.

I hope this helps.

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---
.