Thanks Tristan for your comments. Your comments kicked my thoughts
running again :).

Let me explain how non readable code/decoupling view from presenter
etc can make life easier in terms of designing.(for the Records, i
always like Readable code)

Currently our view and presenter are dependent on each other, although
we use interfaces but still they are tightly bound that view know
there is one presenter for him(implementation may be different by
injection). I have seen the Contacts project code provided by Google
and see presenter(via dispaly) and view(via presenter) call each other
directly.

Now lets say i am writing a wizard screen or my one click will update
2-3 view/panels in my screen.

Ok i will take example where one click will update 2-3 section of
whole page which are basically different view and each will have
presenter.

Say ViewA is header (PresenterA is its presenter)
ViewB is left side panel,(PresenterB is its presenter)
ViewC is Bottom Panel(PresenterC is its presenter)
ViewD is right side Panel(PresenterD is its presenter)

Now there is button/Link on ViewA which say clickMe. On clicking this
ViewB should load some data from server and ViewC should hide some
data, viewD also load some data.

Now as per MVP/Contact project style.
My ViewA should be injected with PresnterA,PresnterB,PresenterC and
PresenterD

And onClick event i will call methods of each presenter, which
eventually raise the required events and which may create history and
then do the server calls. Technically everything is ok(normal java
inetrface/class calls tree), but problem occurs when something
changes. Say now PresenterB doesnt need to update any thing when we
click the same button. At that time you may want to remove PresnterB
from ViewA as whole, you dont want to keep such code as it(PresenterB)
will never be used in ViewA. Or say some new ViewE came up somewhere
and you want to update this via PresenterE, so you need to inject
presenterE dependency in ViewA so that ViewA can a make call like
PresenterE.doSomethingForMe(). Lots of code changes which could be
avoided by just using EventBus.


Say OnClick we just raise an event HEY_BUTTON_CLICKED_ON_VIEW_A and
presenterB,PresenterC,PresnterD will be interested in this event
initially. Once PresenterE will come then PresnterE will be interested
in that too.And when PresnterB says i dont need to update, it will
just stop listening to that event. But i will never touch ViewA class
or any other presenter at all.

And also i looked into AppController class in Contacts project  and it
looks to be controller it self for views and presenter.
I should say its not MVP but its MVPC

Now with using EventBus for all Communcation i am just assesing the
existance of presenter it self(just to make a go call ?). Why do i
need presenter at first place. Just to be tight bound with View??. SO
that if tommorow my site/application goes for mobile i write seprate
presenter which will be bind to seprate view as per Mobile screen. Why
not i just write seprate view and use EventBus.

Basically with in Client(between UI events/activities and server calls
at client side), i am trying to have RPC calls kind of style. UI
request client side code with an event and get response with another
event. I feel its just MVE (Model View Event), no controller and no
presenter.


Does it make sense?
Ravi.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to