Interesting approach, Ryan. So, the big advantage here is cost (free!)
with
the big disadvantage being that we're limited to string data types on the
return. Thanks for sharing.
The other way is to use the XML object. You can put all of your return
data in XML and compress it. XML is extremely redundant, so it compresses
very small, and the decompression is handled by the browser automatically.
With some creative use of the byte array you could probably still pass
binary data (this will be a great help with images stored in a database). I
also regularly use bitmasks in XML, you just have to convert them to numbers
before using them. Serialization isn't a big deal, you just write a
recursive function that serializes/deserializes your objects as XML and use
it in your gateway class. Remoting is a convenience, from my perspcective,
and not all clients can afford to pay for conveniences.
In my opinion, remoting often allows the developer be lazy when they
shouldn't be. I'm not saying that remoting is bad, it just lets you spend
less time thinking about the transport layer, which is often a good thing,
but it can let you be lazy when you should be putting more effort into an
efficient transport layer. Rather than passing whole objects back and forth
simply because you can, it is often more efficient to figure out how to pass
the smallest amount of information in the simplest form, and then it comes
down to building a well thought out transport layer. Some apps benefit
greatly from remoting, but usually those are apps that depend on real-time
data updates, and not your usual DB read/write apps.
If you don't need real-time updates, why spend the resources on it? If
you don't need a response from a "save to database" request to move on, why
not just send it off asynch and let a background listener worry about
whether it saved correctly or not? In fact, if you don't need to know your
data was saved to move on, why not queue DB changes and send them out in
scheduled batches, and worry about DB errors when the batch finishes, saving
the end-user bandwidth and time, not to mention keeping traffic volume on
the server down? It all depends on the needs of the app, of course, but I
find that in most cases, remoting would often be easier on me but that
doesn't necessarily mean it serves the app best.
ryanm
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders