On 15 sep, 20:53, "Jim Freeze" <[EMAIL PROTECTED]> wrote:
>
> JSON can be made as fast and json libraries for python already exist.
> So, I seriously doubt anyone is writing JSON serialization from scratch.
> Your server side code probably only needs to be modified with 
> self.data.to_json.

...but if your client needs to send JSON, you need a JSON-serializer
(which hopefully GWT provides you, but not the most performant, as it
relies on JSONValue wrappers for each and every single thing you'll
want to serialize (or parse, as it works both ways).
com.google.gwt.json.JSON is unfortunately hard to use and generates a
lot of overhead.

For those familiar with c.g.g.j.JSON and JS overlays, here's an
example:
I'm getting a JsArrayString from the server (using an eval() from an
application/json payload), the application's user add/remove values
through the UI and when done, he clicks "save". I then have to
serialize the JsArrayString back to JSON to 'HTTP PUT' it back to the
server.
I'm now doing it with this code:
   (new JSONArray(arr)).toString();
This means that for each String stored in the array a JSONString is
created, only to be toString()ified and thrown away. It also means my
compiled app contains code for JSONString and JSONArray as well as
some code from JSONParser, JSONNumber, JSONObject and JSONBoolean.
I'm thinking about switching to application/x-www-form-urlencoded to
reduce the overhead.

> > 3) For each object passed between client and server, you will need to
> > maintain two copies, one for Django and one in Java for GWT client.
>
> Using a restful approach, you don't pass objects between client and server.
> The stateless server serves up requests for data. No need to complicate
> the issue.

If you exchange JSON payloads, you're exchanging serialized "objects".
Not objects in the OOP sense of the term (implying inheritance,
polymorphism, encapsulation, etc.), but still objects (call them DTOs
if you prefer).

What gregor was talking about though wasn't about "object instances":
with GWT-RPC (or using your own generator), you can have a single
"DTO" _class_ shared between client-side and server-side code.

(I you ask me my opinion: GWT-RPC is not RESTful so I don't use it,
but the hability to share a class between client and server code is
appealing; I'm not using such a thing either though)


--~--~---------~--~----~------------~-------~--~----~
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-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to