Another question beginning with the sentence "I watched Ray Ryan's
talk":
Firstly, great talk. Full of really useful ideas. But I have a
dilemma.
1) On one hand, I want to follow the advice that says "go with the
asynch flow". I'm happy to do that.
2) On the other hand, I also want to follow the advice that object
graphs should be avoided and domain objects should really just contain
ids of their related objects. In the case of lists, this is to avoid
sending too much useless info over the wire. And for AppEngine users
working with JDO, this is unavoidable in any case, for objects in an
'unowned' relationship with the top level object.
The combination of these two pieces of advice leads me to a situation
where I could really do with some advice on what is considered best
practice. Imagine I have a domain object - call it Person - which has
multiple related 'unowned' objects, e.g. Group, Company etc. I want to
list a bunch of Persons on my GWT front end, but the display for each
row requires data from the related objects (e.g. group name, company
name). Following advice 2 above (or perhaps constrained by JDO), my
User object has only the ids of the related Group and Company objects,
and so after retrieving the list of Users from the server side, the
User List Presenter must make a separate RPC call for each Group and
Company object for each User. Let's pretend that because of smart
caching this wasn't particularly expensive (arguable). I'm still left
with the problem that following advice 1 about each call is asynch. I
can't display a User row until I hear back from the two Group and
Company calls. To achieve this delayed display, I have to 'recombine'
the two asynch calls using some kind of local flags, and only when
both callbacks have been triggered is it safe to display the row.
Besides the ugliness and complexity of code like that, there is also
the possibility that the order of my list will be changed due to the
unpredictability of the callback sequence.
There are a number of workarounds I can think of, but I'd really like
some advice based on experience, if somebody is willing to share. The
solution I would tend towards would be to build a graph on the
serverside and to hell with advice 2.
Any takers?
--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to
google-web-tool...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.