Teaching basic lab skills
for research computing

Another Example of small-p Patterns

A couple of weeks ago, I asked whether people would find an exploration of ways to count things useful. The consensus was "yes", so I've started drawing up notes. While working on them, it occurred to me that "ways to persist things" might be just as interesting. Some of the approaches that could be discussed are:

  1. Save a list of numbers (one per line).
  2. Save a matrix using a header line to record dimensions (introducing the idea of metadata) and M values per line.
  3. Save a matrix without metadata (which requires the length of the second and subsequent lines to be checked).
  4. Save mixed atomic values (which gets hard when strings are allowed).
  5. Saving records whose structure is known in advance (the hardest of the bunch, since this is the point where aliasing appears).
  6. Saving in binary rather than ASCII.
  7. Creating self-describing data (save the format at the top, then the data).

What other persistence patterns do you think would be worth explaining, and why?

Dialogue & Discussion

You can review our commenting policy here.