Thanks for the reply but some clarification seems to be needed here.
First of all I am not against the current MVP "best practice" at all
(I used it all the time with GWT 1.x). What my post concerned is
really these:
(1) most frameworks inspired by the Ray Ryan talk were pre-dated GWT
2.0 where UiBinder came to life
(2) with UiBinder in hand, whether and how (if it makes sense) to make
MVP even more straight forward

My argument is that, with UiBinder approach, MyView.ui.xml is pretty
much doing the view while MyView.java is already doing only event-
related processing, with none or minimal UI stuff. I wonder if
anything could be done to further clean up MyView.java (which usually
extends Composite type of container and also handles UI-level events).
Without using a 3rd party framework like gwt-presenter, GWT itself
does NOT enforce an MVP practice. But I think that GWT can go a step
forward to combine a lightweight presenter framework, which works best
with UiBinder.

At least at this point I haven't seen a Google paper/web page
discussing the "best practice" of doing MVP wiith UiBinder - take a
look at the end of this page here -
http://code.google.com/webtoolkit/doc/latest/tutorial/mvp-architecture.html,
Google DOES mention it wants to further elaborate on MVP+UiBinder. But
probably it hasn't had the chance to summarize it? Or thoughts still
have to be developed/speculated at this point?

I hope to make myself clear here that when using a gwt-presenter type
of framework along with UiBinder, we are dealing with two injection
systems, one from Gin and one from UiBinder. Not that we cannot handle
this, but wouldn't it be simpler to combine them? or at least to have
a "best practice" to use them simultaneously? I would like to hear if
anyone has had any experience to share, before Google's "guideline"
comes out.

There is no point of arguing the usefulness of presenter - I use it
heavily. To even simplify my question, how do you inject/create a
presenter, in the UiBinder context? I have ways of doing it but I
would like to find out an elegant way.

Thoughts?

On Feb 4, 6:05 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> 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/GoogleWebToolkitBestPr...
>
> 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