As my software evolves, the structure and/or semantics of a Table’s rows evolves. This is especially true for rows that contain SimpleObject columns, which have no fixed schema, hence no fixed structure. The structure is free to grow and change over time, to fit new needs.
To help distinguish old-format rows from new-format rows, a row_format
column is often added, to make the distinction simple and explicit.
In cases like these, a single “wrapper” class is often infeasible. Which class to use will depend on the row_format
.
For other data sources, I handle this by using a Factory function. It decides which class to instantiate, based on characteristics of the raw data being read.
A similar idea should work for Model Classes.