PeteGashek / puzzlebazar

Automatically exported from code.google.com/p/puzzlebazar
0 stars 0 forks source link

Support for non-singleton presenter #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It could be interesting to support non-singleton presenters. 

For example, these could be used to display an item in a news feed. If the  
item is complex and needs to interact with the server, then it would make 
sense for it to have its own Presenter.

Should they have a proxy? Should the proxy be an eager singleton 
responsible for instantiating its presenters? Could the proxy be a Place 
which is responsible for parsing the history token and instantiating the 
child presenter based on the result?

On the other hand, it could make more sense for the instantiation to be 
handled by the parent presenter. In this case, do non-singleton presenter 
really need a proxy? What would their proxy do?

Original issue reported on code.google.com by philippe.beaudoin on 4 Mar 2010 at 7:08

GoogleCodeExporter commented 9 years ago
I think they should have one proxy responsible for the instantiation of it's 
presenters, but that proxy is only here for code-splitting purpose. It should 
act 
like a place.

Instead a parent should be used to be able to cutomize the general layout of 
its 
presenters. (Ex : Verticaly, Horizontaly, rows and colums). In that parent you 
could 
use a Place and then generating the right list of child elements.

Like you said in the end, the instantiation should be done by his parent 
presenter, 
but a proxy would be usefull in case of really large non singleton presenters.

Original comment by goudreau...@gmail.com on 8 Mar 2010 at 11:33

GoogleCodeExporter commented 9 years ago
It should act like a place. I meant shouldn't

Original comment by goudreau...@gmail.com on 9 Mar 2010 at 12:32

GoogleCodeExporter commented 9 years ago
Makes more sense now. But I'm not even sure it needs a proxy for code 
splitting. Just 
inject and AsyncProvider<> into the parent provider.

Original comment by philippe.beaudoin on 9 Mar 2010 at 12:36

GoogleCodeExporter commented 9 years ago
I finally decided not to use a proxy. I think the result is pretty neat and 
intuitive. See MainPagePresenter for an example on how to use the new 
non-singleton 
PresenterWidget.

Original comment by philippe.beaudoin on 9 Mar 2010 at 4:50