Re:OCaml as the Universal Translator – DkSDK Merry Christmas...
by beckford on Monday December 25, 2023 @09:35PM
(#38768457)
I'd consider that an extension of the "object database" approach mentioned. Just as you mention the application needs to decode (and encode and deal with missing fields) that JSON. And probably in any sufficient size of application you'd have to do this decode/encode in more than one place. That JSON encoding/decoding is a "variation" (more explicitly, a reshaping operation). The engineering costs of having variations strewn across your source code hasn't disappeared.
If you mean propagating changes to a schema across all layers of the stack, that may not necessarily be a good idea. In my experience we want to keep the datatype definitions at different layers somewhat independent of each other, to allow evolving separately. For example, the database table could have a `more JSON` column to allow adding data that was not foreseen in the original table design; but the application's datatype would decode that JSON into specific fields to show the user perhaps.