0.4.14 Where Is the Information Now? Memory vs. Storage

A Running Program Needs Working Information

When an application runs, it works with information such as:

  • current objects;
  • variable values;
  • user input;
  • calculations;
  • current selections.

This working state exists while the program is executing.

For a soccer application, the running program might currently know:

Activity diagram showing running application, then write, then text file.
RunningApplication.

The information begins as part of the current running state.

The program performs a write operation.

The file stores a persistent representation.

Loading Moves Information Back Into the Running Program

The reverse process is:

Activity diagram showing text file, then read, then running application.
TextFile.

The saved information exists in the file.

The program reads it.

The value becomes available to the running application again.

Memory and Storage Are Not the Same Thing

A common beginner misconception is:

That is not necessarily true.

The value may exist only in the current runtime state.

Another misconception is:

Also not true.

The running program needs to read the file before it can work with the saved contents.

A Soccer Example

Imagine an application lets a coach enter:

Saturday lineup: Jordan, Casey, Morgan
Before saving

The text exists in the running application.

If the program closes, the value may disappear.

After writing to a text file

The text also exists in persistent storage.

The program can close, and the file can remain.

During a later run

The application reads the file.

The saved text becomes runtime information again.

Persistence Is About Surviving the Current Session

A value is persistent when it remains available beyond the current program execution.

A text file is a simple way to demonstrate that idea.

Later systems may use:

  • structured files;
  • databases;
  • cloud storage;
  • other persistence technologies.

Those details can differ dramatically.

The underlying idea is the same:

runtime memory is temporary working state; persistent storage preserves information for later use.

Keep Asking the Location Question

As information moves through a program, ask:

Possible answers include:

  • only in the running application;
  • written to a file;
  • read from a file and back in memory.

That question is often more useful than trying to memorize file commands without understanding why they exist.