3 ms·
It is interesting how flat files can manage the evolution of the data structures you use? Any advice?
by ntoshev 20y ago
It is interesting how flat files can manage the evolution of the data structures you use? Any advice?
- brlewis 20y agoIf I understand your question you're wondering how to deal with older flat files when your app expects a newer data structure. If you're using s-exprs make your structure a list where the first element is a version identifier. If you aren't using s-exprs then use some other extensible format like XML.
- vikram 20y agoUse hashtable for everything. So Person who has a name address age and occupation is represented as a hashtable with those fields. When you want to add a new field like emailaddress it's just another key in the hashtable. Ideally you want to code the person accessors so that they still specific externally person-name person-age the rest of the program uses these so it becomes easy to move person to a different structure if that's what you want . You want to write some function to read a hash-table and write on to disc. In lisp this is trivial, but most languages have some sort of serializer. Then a function to load all the hash tables up when you start up.