Wednesday, January 29, 2014

Re: Appropriate server backend API design for spreadsheet like UI interface?

Our app uses aggressive auto saving which means whenever a user changes data we wait a grace period of x milliseconds (mostly 300-500ms) and then send a save request to the server. 

We don't use RequestFactory and probably never will because of its limitations that makes such aggressive auto saving quite difficult to implement. What we currently do is:

1.) GWT-RPC + Command pattern

2.) Commands that save data have an always increasing sequence number associated. We do this because we don't wait for a save response before sending the next save request, so its basically fire and forget unless an exception occurs. That means the server can receive save requests out of order and we have to make sure that things get saved in the same order the client has issued save requests. The sequence number is used to hold back requests on the server until it is safe to process them. Of course there are some edge cases you must deal with but in general its not that complicated. 

3.) Entity versions for optimistic locking are solely handled by the server by tracking which data has been send out to a client. If the client would know the entity version then it could happen that a client sends multiple save requests all having the same entity version associated (because we don't wait for server responses during save and thus maybe don't have the up-to-date version on the client). So our client does not know any entity versions at all.

This "fire and forget" behavior along with multiple pending save requests is something thats not that easy to implement with RequestFactory.

I am not sure if I would recommend that for a mobile / tablet app because of all the requests but for desktop apps it works well so far. No save button, no locked UI during data edit. If the user creates data this is mostly done through wizards which of course have a save/ok button so that we can ask for required fields.


-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment