Serialization Framework

compared with
Current by Andrew Griffin
on Mar 25, 2010 09:38.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (3)

View Page History
* Make interoperability between platforms the default - i.e. encourage people to avoid things like platform-specific namespaces on types.
* Support [evolvability of data|#evolvability] natively within the framework, don't make each developer have to bolt this on.
* Keep it easy to use - both for developers hand-coding message/object conversions and for the automated [code generator|Automatic Code Generation]. generator|Fudge Proto].
* Don't restrict programming patterns, in particular don't prevent immutable objects.

| Primitive member \\ | Field with same name as member \\ |
| List or array \\ | Use native Fudge type if available. Otherwise, represent as a sub-message containing a repeated field with no ordinal or name for the list or array data. These fields would in turn be sub-messages in the case of multi-dimensional arrays. \\ |
| Null \\ | If simple field, omit the field or use Indicator (implementations must always deserialize Indicator as null). If it is an element within a list/array, use the Indicator type. \\ |
| Map \\ | Represent as sub-message with two repeated fields. Fields with ordinal 1 contain keys. Fields with ordinal 2 contain values. \\ |
| Reference \\ | See below \\ |
Note that an alternative list and array representation could have used repeated fields. The representation above gives a more efficient packing for any arrays of length 3 or more (or of length 2 or more if the field name is more than a couple of characters) due to not repeating the field name or ordinal. It also allows arrays of arrays to be encoded in a consistent fashion.

Note that the map representation chosen gives a more efficient packing than representing as a list of key-value pairs. The map is defined here as a list of 2-tuples. Although key/value ordering will be preserved within the Fudge message, higher level language objects do not have to treat the map as ordered. If a language has native object constructs that correspond to higher orders, they could be encoded in a similar fashion. This implies that a set could be encoded, and distinguished from a list, by using fields with ordinal 1 instead of no ordinal. An implementation that does not support a set may treat such an encoding as a list or array.

h3. References