On Jun 3, 9:57 am, walden <
wmath...@aladdincapital.com> wrote:
> Ryan,
>
> Your responses confuse me. I though you were seeking a Lazy Loading
> for GWT. Here you say you're not. At the beginning of the thread you
> give an obviously synchronous method signature for retrieving an
> object property, but you say in text that it does not have to be
> synchronous. What the heck are you after?
Yes, reading back over that last post, I can see how it could be
confusing. What I meant was that the approach Ping suggested is not
what I was looking for: "...design an app expecting accessors
(getters) to be asynchronous and do some sort of event pub/sub for
class properties". That's the part that I meant I wasn't trying to do--
I'm not trying to create some client-side framework that developers
have to code to. I explicitly stated in my original post that I was
looking for a non-intrusive solution.
Here is the specific problem I'm trying to solve: Hibernate is used on
the server for data access. GWT is used to generate the client. Domain
objects/entities are passed from the server to the client, currently
using dozer to assemble to and from representative DTOs for two
purposes: 1) strip out java 1.5+ generics that GWT couldn't previously
handle and 2) to clip the object graph at appropriate places so that
the entire database doesn't get loaded and sent back to the client.
With GWT 1.5, the generics problem goes away. We'd like to do away
with the object graph clipping for a few reasons, one of which is that
the application is growing and it's becoming more and more of a pain
to make sure that our clipped object graph(s) are suitable for every
possible use case. Lazy loading solves this problem. We already have
lazy loading on the server. It should be a simple matter to port it to
the client. In fact, it *is* very simple to port to the client with
the exception of needing a synchronous call to make it work. That
problem is what this thread is all about.
When you write a GWT client, you expect to be serializing objects back
and forth between client and server. You expect that those objects
will behave the same on the client as on the server--specifically, if
you call foo.getBar() or, more importantly, parent.getChildren(), that
you will be returned a value that you can immediately operate on. On
the server, this is perfectly safe because lazy loading is done
transparently within the getBar or getChildren call. That's what I'm
trying to achieve on the client.
Despite all the informative replies, it still seems that a synchronous
call is the only way to achieve this, making it of fairly limited use.
It looks like a widely-usable solution would have to have some kind of
client-side framework to create a different way of calling methods
involving callbacks. That would get really messy.
[...]
> I agree with Ping on this. I think he said what I was trying to say
> above, only better. Specifically, designing network applications is
> different from designing desktop (i.e., "all resources are local")
> applications, and this is one of the places where that distinction
> rears its head. Apps that use the net but pretend not to use the net
> end up sucking -- because how the net gets used impacts user
> experience so strongly. Hence all the J2EE "patterns" that sprouted
> up last decade to try to convince developes to stay away from fine
> grained transfers and pay attention to partial failure states that
> don't exist in simpler environments.
>
> Also, good point Ping that *most* gui programming works on the async
> model, not just the web ones.
I think that I'd generally agree with all of that except maybe the
"use but pretend not to use" part. It's the "how" part that has a
major impact on the suckiness. I think that the real mismatch here is
trying to marry up a traditional webapp backend with a near-desktop-
like frontend. I don't know what the real solution is yet, but I
suspect that the dire lack of desktop app best practices will be
corrected in the near future as GWT and similar technologies gain
users.