Data Flow Data "flows" through a program, being modified and stored (in different variables) along the way.
- Data Flow
Information can be said to "flow" through a program. What is meant is that each line in the program (executed independently and sequentially) takes in previously computed (or inputted) information, modifies it or extracts more information from it, and stores this information in a new variable.
You can think of this as "Data builds new Data." Data (or information) is created, stored in a variable, and then used to compute more data, which is likewise stored in new variables (or replaces the old values in old variables).
The Data Flow Pattern
// Store some original data value in a variable
variable_1 = ...; // input from user (or file, or hard coded in program); // Use this original data to compute some new information
variable_2 = function_1 ( variable_1 );
// Use this new information to create even newer information
variable_3 = function_2 ( variable_2 );
// Use the new information to modify the original value
variable_1 = function_3 ( variable_2, variable_3 );
As you can see, as a program steps through its sequence of instructions, each instruction will usually use "information" computed "above" to compute even more information to be used "below." Additionally, the information stored in the variables can be used to cause the program to take a different path using if statements or while loops.