PERSISTENCE

Persistence

Examples

Application data persistence

Complexity

Storing and retrieving simple data

Serialisation of data

Example 1: structure

    struct Customer {
        char last[20];
        char first[20;
        int id;
    }

Example 2: linked list

Linked list:

This can be represented by

Example 3: string

String: "hello"

Example 4: array


Can be represented by

Example 5: circular list


Can be represented by

Example 6: binary tree


Prefix order is: node left right
Trees can be stored and restored by writing them in prefix order, with a special flag for empty tree.

Example 7: graph


These need to be stored in a table
a b
b d
a c
c d

Identity problem

Objects

Serializable interface

Serializing an object (graph) to file

Restoring an object (graph) from file

Versioning


Jan Newmarch (http://pandonia.canberra.edu.au)
jan@ise.canberra.edu.au
Last modified: Mon Aug 28 13:30:18 EST 2000
Copyright ©Jan Newmarch