Flow chart symbols

Flow charts are a useful tool for software documentation. This article introduces flow chart symbols for source code visualization. These symbols let you visualize the structure of a function, statement by statement.

There are several ways to draw flow charts. Source code documentation requires a different set of flow symbols than, say, documenting a manual process or designing a completely new system.

The flow chart symbols described here are based on Visustin, a flow chart generator that converts source code to flow charts. These symbols are a practical way to visualize source code at the statement level. The actual code is written into the symbol. This way one gets a very detailed visualization of the source.

Flow chart symbols for source code visualization

Flow chart symbols
Header
Start of flow. Function header or program starting point.
Regular statement
A normal statement that doesn't branch, jump or loop.
Decision (Decision diamond)
A 2-way branch. An if or another decision. The condition appears inside the diamond. Example: x<y? Two arrows lead out of the decision. These arrows may be labeled with Yes and No, meaning the then and else branch, respectively.
Multiway decision
A decision with multiple alternatives. A select or switch statement or similar. Followed by a chain of decision diamonds depicting the actual decisions taken i.e. cases executed.
Loop
Start of a repeated block. A for statement or similar. The end of the loop body connects back to the loop symbol. How many times the loop executes depends on what is written inside the loop symbol.
Jump
Unconditional jump to a target outside the current flow graph.
Block start
A statement that affects the following statements. Examples: try, catch or with block.
Block end
Marks the end of the block started with Block start.
Terminator
End of flow. Several terminators are possible in a single chart.
Exception
Exceptional end of flow. Untrapped run-time error.
Flow
Execution flows along the arrows.
Alternative header and jump
Header and jump can also be drawn as an ellipse.
Alternative loop
A loop can also be visualized with a decision diamond. Two arrows lead out of the decision: one to the loop body and the other to the next statement after the loop. End of loop body connects back to the decision diamond. When the loop end condition is met the flow goes from the decision diamond to the statement following the loop.
Source code
Source code appears directly inside the symbols. To fit long pieces of code, word-wrapping and symbol stretching is required.
Comments
Comments can be written anywhere in the flow chart. No special symbol is required. A connecting link or arrow can be draw to link a comment to the respective statement. Comments may also be written into the program flow as if they were executable statements.
Color
Color can be used to emphasize the structure. Colors can group together related statements, such as a multiway decision and its cases, or block start and end. Colors include: blue for multiway decision and its cases, violet for loop, red for exception; green for a Yes flow and red for a No flow.

As you can see, the number of flow symbols is small. Only a few symbols are required to visualize code at the statement level. Higher-level concepts such as printing, disk access and sorting require no specific symbols. This keeps down the number of flow symbols to learn.

These symbols form a practical way to visualize source code as flow charts. The symbols are not a formal standard.

Flow chart samples

Sample flow charts
See the symbols in action.

More on flow charts

Visustin Flow chart generator
Program that converts source code to flow charts.

Visustin help - Chart symbols
More details on the various symbols.

Flow chart symbols
URN:NBN:fi-fe201108172229

©Aivosto Oy -