she-philosopher.com > HOME

a she-philospher.com Library publication

Library Catalog No. DC1980
(reissued 20 August 2012)

Information packet on D-Charts, with articles from the late-1970s (Item 3 of 4)
by Kim Harris, et al.
e-Copyright © 2004–2016 < http://she-philosopher.com/library.html >
see also Part 1: Editor’s Introduction for Library Cat. No. DC1980

 

D-CHARTS
by Kim Harris
(September 1976)


A D-chart is a style of flowchart using structured control symbols. The “D” comes from E. Dijkstra, a promlnent Dutch computer scientist, who created them.

Compared to traditional flowcharts, D-charts are:

  • simpler
  • easier to learn, read, and create
  • more powerful and descriptive, and
  • more compact.

They are simpler because they form a language which is in the same complexity class as programming languages (i.e., context free languages). Traditional flowcharts are more comp1ex, but are actually at a lower level than D-charts (i.e., fewer D-chart symbols are required for the same structure as compared to traditional flowchart symbols). D-charts have only a few, powerful symbols so they may be learned quickly. In traditional flowcharting, there is no symbols for loop control which is a tragic shortcoming. Finally, D-charts are more compact, frequently allowing a minimum of a 2 to 1 reduction in the size of the chart. This makes for fewer (or no) lines going off one page and onto another. The most significant difference in appearance between the two styles is that D-charts do not use boxes (rectangular, diamond, circular, or any others). This helps call attention to the structure of the program.

Sequential statements are written in free form, one below the other, and without boxes.

statement
next statement
next statement
    .

    .

    .

The form of these statements may be the same as a specific language or more free-form and English-like.

Examples:



The free-form statements in this document use the following conventions:

  • key words are underlined
  • each statement is terminated by a semicolon (;)
  • the assignment operator is  [left-pointing arrow]
    (less ambiguous than =)

Calls to subroutines are treated like other sequential statements.

Examples:

CALL SUBR     call subr;

Arguments in the call may be listed in program syntax form, as:

CALL SUBR (X,Y,Z)

Or, more clearly, in two lists: one for input variables (values passed to the subroutine) and another for output variables (values returned from the subroutine).

call subr ;
     inputs: x,y
    outputs: y,z

All variables and values passed between the called and calling subroutines should be listed. This not only includes actual arguments, but also COMMON variables which are used by both routines.

The only “lines” in D-charts are used to show nonsequential control paths (e.g., conditional branches, loops). In a proper D-chart, no lines go up; all lines either go down or sideways. Any need for lines directed up can be (and should be) met with the loop symbols. This simplifies the reading of a D-chart since it always starts at the top of a page and ends at the bottom.

Following are definitions and examples of the D-chart symbols:



Entry Name Symbol

At the top of the D-chart, the entry name is written and underlined twice:



Arguments and COMMON variables for the program may be listed as with subroutine calls:



The final statement of a proper D-chart is RETURN (or return;). So the following is a complete and proper D-chart:





If...Then...Else Symbol



Either the “true block” of statements or the “false block” may be null, in which case a line is drawn vertically connecting the top and bottom portions of this symbol.

Example:



Either the “true block” or “false black” (or both) may be any control structure which obeys the general structured programming role of “one input path, one output path.”

Example:



Since this is only a two-way branch, the “condition” written on either side of the branch symbol (IF...THEN...ELSE symbol) implies that the other side (usually unlabeled) is taken when the “condition” is false. The usually unlabeled branch may be labeled if desired for clarity or documentation.

Example:



If preferred, the “condition” may be enclosed in parentheses to avoid confusion between a statement to be executed and a condition to be tested. This is especially desirable on a complicated D-chart which has conditions and statements close together.

Below is a D-chart of a portion of a FORTRAN program with this parenthesis notation used.





Do While Symbol

This is one of two loop-defining symbols based on the DO WHILE control structure.



The keyword “WHILE” may be optionally included for clarity. It will be omitted in the examples which follow.

The meaning of this symbol (and the DO WHILE statement) is described below.

The switch symbol:



indicates that when the switch is encountered, the “condition” (on the side line) is evaluated.

1. If the “condition” is true, then the side line path is taken; if false, then the down line is taken (and the loop is terminated).

2. If the side line is taken, all statements down to the dot are executed. The dot is the loop end symbol and indicates that control is returned to the switch.



3. The “condition” is again evaluated. Its outcome might have changed during the execution of the loop statements.

Repeat these steps starting with Step 1.

The “condition” might be an index which is changed each time through the loop (e.g., FORTRAN DO loop index).

Example:



Or the “condition” may be a logical expression.

Example:



Or it may be a combination of these.

Example:



The statements within the loop may be any control structure which follows the general rule of one input path and one output path.

Example:



When loops are nested, labels on each pair of {switch, dot} or {loop start, loop end} symbols may make the nesting structure clearer.

Example:



Another style which connects the loop end with the loop beginning uses matched symbols within both the switch symbol and the dot circle.

Example:



For multiple or nested loops, different symbols may be used for each pair.

Example:





Do Until Symbol

This is the second loop definition symbol and is very similar to the DO WHILE symbol.



Note that only the keyword “UNTIL” was added to the former loop symbol. All loops in D-charts use this same conditional switch notation. Because the DO WHILE construction is more common than the DO UNTIL, the “WHILE” keyword is usually omitted, but the “UNTIL” keyword must be used.

This construction was added for convenience only. The “UNTIL” condition is equivalent to “WHILE not condition.”



Escape Symbol

For convenience, a loop termination condition may be expressed as as ESCAPE (from the loop) condition. Consider the following example:



The loop is terminated either on “condition 1” becoming false, or on “condition 2” becoming false. “Condition 2” is the ESCAPE condition, and the horizontal line exiting the loop is the ESCAPE symbol. The ESCAPE path may only lead to the statement following the loop it is contained in, satisfying the “one in, one out” rule. Note that a single ESCAPE cannot exit more than one loop in a set of nested loops.

This construction is for convenience; it does not add a capability absent otherwise. To illustrate this, the following two examples are presented. These are computationally equivalent.



This convenience must not be abused. In every case, the correct use of the ESCAPE symbol must be equivalent to a structure which has only one output path, and this requirement must be verified for the particular loop structure it is used in.



Case Symbol

The CASE symbol provides a multiple-path branch such as that provided by FORTRAN’s computed GO TO. A two-way CASE symbol is equivalent to an “IF...THEN...ELSE” symbol. The “one input path, one output path” requirement is met by requiring that all branches of the CASE symbol return to a single statement following the CASE symbol.

Example:



If the number of statements at each CASE branch is few, the above form may be used. The CASE blocks (of statements) are then written in columns on the page, one column per CASE branch. But if the number of branches is too large, or if the statements in each CASE block are complicated, then this column approach is impractical. A better approach is to write each CASE block one after the other on the page using a label to identify each block, as follows:



Another style would not put the body of each CASE in line with the D-chart but would indicate what is to be done by all CASES using a comment or call statement, then listing the separate cases as subroutines on separate D-charts. The following example illustrates this technique.

Example:



The “condition” can be an index variable selecting which branch is to be taken (like FORTRAN’s computed GO TO index), a logical expression, or even a free-form description of the condition. The following is an example of this last form.




» next (Item 4 of 4)
» Item 1 of 4   (D-Charts, anonymous overview, March 1980)
» Item 2 of 4   (D-Charts, by Kim Harris, ca. 1978)
» Item 4 of 4   (5 sample D-charts)

top of page | Part 1: Editor’s Introduction for Library Cat. No. DC1980

upper-level LIBRARY page | she-philosopher.com HOME page | support this site

This Web page was last modified on:  07/14/2016 12:50 PM.