UC3M

Telematic/Audiovisual Syst./Communication Syst. Engineering

Systems Architecture

September 2017 - January 2018

10.5.  Information persistency

A question that a software application developer must ask himself/herself about the data of an application, is if the data should be persistent or not along different program executions.

It is usual that a software program will be executed several times. Each time that the program is executed, is launched by a command. This program in execution will finish when it receives a signal, reaches the end of the code (maybe there is even an option to finish that the own user has available in the menu) or because there is a call to a function that will finish the program. This program can be executed several times, repeating the cycle in which the program is executed and finished.

There are some occasions in which the application requires that the data that already existed as a result of the previous historical executions, must be maintained, this is that this data must be persistent (e.g. that photos that were included in previous executions must be available when listing the photos in future program executions). While, there are other occasions in which the application requires that the data that already existed from previous executions, must not be maintained, and the application starts from scratch after each new execution, this is that this data must not be persistent (e.g. the listing of photos must be NULL at the beginning of the program execution and the photos that are shown must be only the photos taken in the last session).

For the storage of persistent information along different executions, there is not a possibility to store such information as program memory (neither static nor dynamic), because after the termination of the program execution, such information will disappear, or even worst, the information will be inaccessible, wasting memory resources (in case of memory leaks). For this reason, for the storage of persistent information, other methods must be used, as the following:

  1. Storage in a data base: This topic is not scheduled for this course. It is a set of utilities that allow the persistent storage using a collection of tables. They allow to define tables, their primary keys, table relationships, etc. and they are optimized to perform data operations quickly.

  2. Storage in files. One or several files can be used to store the information in a persistent way along different program executions. The files will survive along different program executions, so the information will be persistent, and the information can be read an written in different executions. If this option is used, a criteria must be followed to store the data in a file, so that the information can be retrieved later following the same criteria.

Regarding the non persistent information, static or dynamic memory can be used. For the specific case of each one of the tables and their relationships, some possibilities will be given in this material later.

10.5.1.  Self-assessment questions

Answer the following questions

  1. The persistence of information makes possible that in future program executions the information can be accessed by the program.

    • True

    • False

  2. Where does the persistence information is stored?

    • RAM memory

    • Data bases and files

  3. A criteria should be used to store the data into files; thus the data will be recovered by using this criteria in future program executions.

    • True

    • False