Forgot to push publish.
Besides having some family over to the house for dinner,
today’s coding was even more Flatbuffers coding.
I’m in the trough of disillusionment with FlatBuffers.
For FlatBuffers, one writes a schema description of records. The tool then generates
serialization and deserialization code for the target language. The coolness comes from
the the streamlined deserialization which minimizes data reformatting and copying.
But the programming interface to these serialization routines is a tad clunky.
Firstly, you never know what type of serialization interface it is going to generate.
Sometimes it will generate a single create call to build a structure and sometimes
it generates a ‘start’ and ‘end’ function with ‘add’ functions for the fields.
It took me a while to realize the interface difference comes between ‘struct’ and
‘table’ definitions. Another factoid that is not explained in the documentation.
Another thing I’m learning is that the serialization interface gets complex if one
defines a protocol with ‘table’s inside ‘table’s.
Using the schema, it is easy to define a record that includes several tables.
The problem comes in the complexity of the record generation code – table
generation code embedded in table generation code embedded in table generation
code. The make-a-record subroutine becomes long and complex.
Additionally, if a field is ever added to a table, code in several different
places will need modification.
It would be nice if the code generator created some higher level code.