On Feb 3, 5:51 am, mahjong <kornh...@gmail.com> wrote:
>
> Personally, I don't like the "Presenter.Display" approach where you
> define a bunch of methods returning "HasClickHandler", "HasText",
> "HasValue" type of things - though the presenter no longer cares about
> the UI layout, it still needs to know about the component types in
> that UI. How clean is such a separation?
>
> To summarize, I would like to leverage UiBinder as View, and its
> corresponding same-name java class as Presenter, and fire events
> directly inside "@UiHandler" annotated methods. And that's it.
>
> Any thoughts, anyone?

The whole point of MVP *in GWT* is to make the presenter only depend
on "pure Java" classes, so you can unit test it in pure Java (no
GWTTestCase involved), which saves you precious seconds.
The goal is absolutely not to make it possible to exchange the view
with another implementation.

In practice, it also happens that you generally deal with styling et
al. in response to events; this much better fits in the view than in
the presenter where you won't be interested into such details (the
presenter doesn't care whether "view.highlight()" sets borders, a
different background, makes text bold or blinking, either by
manipulating the widget's getElement().getStyle() or setStyleName();
the presenter doesn't care whether a "button" is actually a Button or
a PushButton, or a Label or HTML, provided it HasClickHandlers; etc.)

It's all about pragmatic, not at all about overengineering. The idea
is to have as much things as possible in the presenter so you can unit
test it, but nothing that depends on JSNI (i.e. no Widget) so you can
unit test in pure Java.

You should really (re)watch Ray Ryan's talk:
http://code.google.com/events/io/2009/sessions/GoogleWebToolkitBestPractices.html

But in the end, this is all just a suggestion. You should do what you
think is OK, not what people tell you is OK. (but if you refuse to
follow some "best practice", you'd better understand what it's meant
to be useful for, what problems it addresses, etc. and compare this to
the pros and cons of your own approach before making a choice)

-- 
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