Return-Path: X-Original-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E70F093F4 for ; Thu, 5 Apr 2012 22:35:28 +0000 (UTC) Received: (qmail 13700 invoked by uid 500); 5 Apr 2012 22:35:28 -0000 Delivered-To: apmail-incubator-flex-dev-archive@incubator.apache.org Received: (qmail 13660 invoked by uid 500); 5 Apr 2012 22:35:28 -0000 Mailing-List: contact flex-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flex-dev@incubator.apache.org Delivered-To: mailing list flex-dev@incubator.apache.org Received: (qmail 13651 invoked by uid 99); 5 Apr 2012 22:35:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Apr 2012 22:35:28 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of olegsivokon@gmail.com designates 209.85.210.175 as permitted sender) Received: from [209.85.210.175] (HELO mail-iy0-f175.google.com) (209.85.210.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Apr 2012 22:35:20 +0000 Received: by iaag37 with SMTP id g37so2396744iaa.6 for ; Thu, 05 Apr 2012 15:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=iMmcqDbt23LtzYIE0dpta5cNjSCUnXi3+SwYdpjCGjg=; b=iIB6EzTK9rDG7G2X4NEzTymTDCmaMKJWhVfGSDrZ2qRtbbRHd6nKe1TSfRE2TSn21o nZPoywZIAxNrR57qhgeml0DDrJ8SBxuJ8PceO7T8QLHYtKt2FU9XfIUeJwQtvbORJaAJ K7iYjHyqra7H+bVCQIrT4aARMxfRtVaFWmMN05FRwIewhZpKdnJ9IlGdWErYTe046tBk vd0tA1PPXOR2hUZmoj5I/ids8ZkEMDkfUC6KiYc9AVDV7xD9SdVqdlwYnG+0P/BLhowx F7h3bJlJJPHv493KDWwHa52SSBicX6ShoPEGJNO3VU6ebQWynAAZ7ovg11rz0BVgvkTO iRjw== MIME-Version: 1.0 Received: by 10.50.216.232 with SMTP id ot8mr7556970igc.22.1333665298863; Thu, 05 Apr 2012 15:34:58 -0700 (PDT) Received: by 10.43.124.200 with HTTP; Thu, 5 Apr 2012 15:34:58 -0700 (PDT) In-Reply-To: References: Date: Thu, 5 Apr 2012 18:34:58 -0400 Message-ID: Subject: Re: RFC - additional registerClassAlias From: Left Right To: flex-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=14dae934048d63577b04bcf6265e --14dae934048d63577b04bcf6265e Content-Type: text/plain; charset=ISO-8859-1 Well, the whole thing about how serialization in Flash works is moot... but it's not anything that we could help, even if we wanted to very much. Probably, it should be made clear that this is not just serialization into some amorphous format, especially because JavaScript, if we will ever get there, will need it's own AMF implementation (which is actually easy!). There are other problems current model doesn't solve (because it was blind-copied from Java, and it just works bad there too). Anyway, recursive serialization of IExternalizables is a pain - you can't really do this using just the built-in API, chances are, that if that is what you need, you will write AMF serializer on your own, in AS3 :) Funny, eh? Besides, if you have a more complex object to serialize, where several IExternalizables plug in, you won't be able to take advantage of AMF format because it, when writing these objects is not aware of the context, where they will be placed, and it will not "optimize" the parcel after the last write. Essentially, in order to have effective AMF serializer, the existing native API are lacking. You _always_ need the context, where you write your objects. Always as in any non-trivial situation. Alternatively, you can do it in two layers - similarly to how tar is usually used with gzip (tar creates single piece file, while gzip compresses the whole thing). Present AMF serialization model in this light resembles that of zip, where both the archiving and compressing done by single program file by file causing bad reuse rate for when you are compressing more then one file. Now, there's another aspect. Framework prescribes serializing views! Against all odds you serialize the collection's view (and you forget about how it was sorted and the bookmarks and all that). This is a bad practice. No one, ever, should have serialized ArrayCollection, ObjectProxy and other *abominations* :). Yet another problem is with [RemoteClass] meta. It - makes the process almost impossible to debug (w/o in-depth knowledge of the framework templates you wouldn't know where the code registering alias goes). This created a whole lot of mythology and superstitions. - you can't control when it happens (effectively, you don't even know, but assume it's before the application even starts - which is of course wrong). All that said - I'd be for making the mechanism more transparent, if at all taking any steps in order to build on top of what built-in functions have to offer. But if I was to design the API for this, it would be something like: AMFContext.createContext() :: AMFContext; AMFContext.registerAlias(Class, "alias") :: void; AMFContext.append(object) :: void; AMFContext.onSerialize(function(Class), data) :: void; AMFContext.onDeserialize(function(Class), data) :: void; AMFContext.flush() :: ByteArray; So, while we add more classes *sigh*, we could actually reduce the size it takes on the wire, when serializing everything in one go, instead of doing it item at once. But in this way we avoid global handling, security problems with who registers alias where and so on... Well, just brainstorming :) Best. Oleg --14dae934048d63577b04bcf6265e--