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 2 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
(article for the FORTH Interest
Group of San Carlos, CA
ca. November 1978)


An alternative style of flowcharts called D-charts will be described. But first the purpose of flowcharting will be discussed as well as the shortcomings of traditional flowcharting.

A flowchart should be a tool for the design and analysis of sequential procedures which make the control flow of a procedure clear. With FORTH and other modern languages, flowcharts should be optimized for the top-down design of structured programs and should help the understanding and debugging of existing ones. An analogy may be made with a road map. This graphic representation of data makes it easy to choose an optimum route to some destination, but when arriving, a sequential list of instructions is easier to use (e.g., turn right on 3rd street, left on Ave. F, go 3 blocks, etc.). Indentation of source statements to show control structures is helpful and is recommended, but a two dimensional graphic display of those control structures can be superior. A good flowchart notation should be easy to learn, convenient to use (e.g., good legibility with free-hand drawn charts), compact (minimizing off-page lines), adaptable to specialized notations, language, and personal style, and modifiable with minimum redrawing of unchanged sections.

Traditional flowcharting using ANSI standard symbols has been so unsuccessful at meeting these goals that “flowchart” has become a dirty word. This style is not structured, is at a lower level than any higher level language (e.g., no loop symbol), requires the use of symbol templates for legibility, and forces program statements to be crammed inside these symbols like captions in a cartoon.

D-charts have a simplicity and power similar to FORTH. They are the invention of Prof. Edsger W. Dijkstra, a champion of top-down design, structured programming, and clear, concise notation. They form a context-free language. D-charts are denser than ANSI flowcharts, usually allowing twice as much program to be displayed per page. There are only two symbols in the basic language; however, like FORTH, extensions may be added for convenience.

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

statement
next statement
next statement
    .

    .

    .

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.

It is customary to underline the entry name (or FORTH definition name) at the top of a D-chart.




2-Way Branch Symbol

In FORTH, this structure takes the form:

condition  IF    true phrase
           
ELSE  false phrase
           
THEN  .

Another FORTH structure which is used for conditional compilation has more mnemonic names:

condition  IFTRUE     true phrase
           
OTHERWISE  false phrase
           
ENDIF      .

The D-chart symbol has parts for each of these elements:



The “condition” is evaluated. If it is true, the “true phrase” is executed; otherwise, the “false phrase” is executed. The words following ENDIF (or THEN) are unconditionally executed.

If either phrase is omitted, as with

condition IF   true phrase   THEN

a vertical line is drawn as shown:






Loop Symbol

The basic loop defining symbol for D-charts is properly structured.



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 statement.

Repeat these steps starting with Step 1.

This symbol tests the loop condition before executing the loop body. However, other loops test the condition at the end of the loop body (e.g., DO .. LOOP and BEGIN .. END) or in the middle of the loop body. This loop symbol may be extended for these other cases by adding a test within the loop body. Consider the FORTH loop structure

BEGIN   loop body   condition END   .

The loop body is always executed once, and is repeated as long as condition is false. The D-chart symbol for this structure would be:



A more general case is

          BEGIN   first phase
condition IF      second phase
          
AGAIN

which is explained better graphically than verbally:



Both previous symbols may be properly nested indefinitely. The following example shows how these symbols may be combined. This is the FORTH interpreter from the F.I.G. model.






n-Way Branch Symbol

A structured n-way branch symbol (sometimes called a CASE statement) may be defined for convenience. (It is functionally equivalent to n nested 2-way branches). One style for this symbol is:



The condition is usually an index which selects one of the cases. The rejoining of control to a single line after the cases [is] required by structured programming. Depending on the complexity of the cases, this symbol may be drawn differently.




D-charts are efficient and useful. They are vastly superior to traditional flowchart style.

;S    KIM HARRIS




» next (Item 3 of 4)
» Item 1 of 4   (D-Charts, anonymous overview, March 1980)
» Item 3 of 4   (D-Charts, by Kim Harris, September 1976)
» 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:49 PM.