For a program, like a computer in miniature, the program is input, output, data storage, execution (data processing). Among them, the storage of data in the program occupies a considerable proportion and role.
During the execution of the program, the data in the program can be divided into different data states, such as global, local, static, constant, etc., and the data types are divided into: shaping, character type, floating point type, string, etc., data is stored in memory queue, stack, staging area and peripheral (hard disk).
Once the program executes, the data in memory is lost, the program cannot continue to use the last data, and we cannot save the results of the execution.
Therefore, persistent storage of data becomes an important aspect of program writing.
Data persistence, we can save object-oriented data into a data file, or to store the data in a database, by storing the properties and values in the object, we can store the corresponding data information stored on the peripheral, we use the process, and then read from the peripheral.