Persistence in Object Oriented languages

Figure 832. Persistence [Bauer2015] Slide presentation

Persistence allows an object to outlive the process that created it.

The state of the object may be stored to disk and an object with the same state re-created at some point in the future.

Figure 833. Java transient instances Slide presentation
public class User {
  String commonName; // Common name e.g. 'Joe Bix'
  String uid;        // Unique login name e.g. 'bix'
  ...                // getters, setters and other stuff

// Thread lifespan (transient instance)
User u = new User("Joe Bix", "bix");

Figure 834. RDBMS persistent records Slide presentation
  commonName CHAR(80)
-- Persistent record (see Durability in ACID)
INSERT INTO User VALUES('Joe Bix', 'bix');

Figure 835. Persisting transient User instances Slide presentation
Persisting transient User instances

Figure 836. Observations Slide presentation
  • Processes in disjoint address spaces:

    1. JRE™ runtime.

    2. RDBMS server.

  • Multiple runtimes possible (PHP)

  • save and load denote communications across OS boundaries.