warning_.gif Draft Created: 5/26/98; 3/26/06; 4/29/07; 11/5/07 warning_.gif
"SPAGETTI FLOWCHART" EXAMPLE

The following old fashioned flowchart actually existed in a textbook for introductory programming back in the late eighties. Compare it to it's equivalent Structured Algorithm Chart which follows.
 
 

OLD-FASHIONED "SPAGETTI" FLOWCHART
(From an actual textbook, of the 1980s)
  1. Note how the logic flow goes in all directions, seemingly at random; this is a consequence of the undiciplined use of the notorious "goto" statement of pre structured programming.
  2. Modularization is NOT explicit, although "could be implied" by the number rectangles, i.e. they "could be" invocations of procedures and functions; however, that is unclear; if invocations were present, the flowcharts of the procedure or function should also be displayed.   See the next illustration where explicit procedure/function invocations are presented.

The following is the SAC equivalent of the "spagetti flowchart" example above.

STRUCTURED ALGORITHM FLOWCHART EQUIVALENT OF THE PRECEDING FLOWCHART

  1. Unlike the spagetti flowchart above, the "structured" logic flow is exclusively top-down, or left to right, exactly mirroring the format of modern program code.
    1. The left most vertical line represents the top level algorithm of the main program.
    2. Each indention mirrors the indention of code within selection constructs and looping constructs (in all structured programming languages and OOSD languages).
    3. There are only two kinds of control structures, selection (represented with diamonds) and iterations (represented by pentagons, or hexagons).
      1. Note that the particular kind of control structure can be left unspecified (blank diamonds or pentagons); this is a particular  advantage of SACs over pseudocode, where everything is text.
    4. Note that the "REPEAT UNTIL" control structures are equivalent to the do while constructs of C, C++, Java, etc., i.e. they are looping constructs with the condition for repetition at the end of the loop body.
  2. Modularization is explicitly represented by the procedure invocations in the upper SAC which call PROCEDURE 1 and PROCEDURE 2.  (It is assumed that these are "procedures", rather than functions, because it is unclear, in the spagetti flowchart, wheter a value is returned (as done by functions) or parameter values are passed back (as done by procedures), the latter being the most general technique.