Nassi-Shneiderman diagram

from Wikipedia, the free encyclopedia
Logo of the German Institute for Standardization DIN 66261
Area programming
title Information processing; Symbols for structograms according to Nassi-Shneiderman
Brief description: Structograms
Latest edition 1985-11

A Nassi-Shneiderman diagram is a type of diagram used to represent draft programs as part of the structured programming method . It was developed in 1972/73 by Isaac Nassi and Ben Shneiderman and is standardized in DIN 66261. Since Nassi-Shneiderman diagrams represent program structures, they are also known as structured diagrams .

The method breaks down the overall problem that you want to solve with the desired algorithm into smaller and smaller sub-problems - until finally only elementary basic structures such as sequences and control structures remain to solve the problem. These can then be visualized using a Nassi-Shneiderman diagram or a program flow chart (PAP). The procedure corresponds to so-called top-down programming, in which an overall concept is first developed, which is then resolved by refining the structures of the overall concept.

Böhm and Jacopini demonstrated in 1966 that any algorithm can be formulated without an unconditional jump instruction (GOTO). The control structures of modern programming languages can be found trivially for Nassi-Shneiderman diagrams ; this can be much more difficult for program flow charts.

Symbols after Nassi-Shneiderman

Most of the following structure blocks can be nested within one another. The structogram, made up of the different structural blocks, is on the whole rectangular, i.e. just as wide as its widest structural block.

Process symbol


Each instruction is written in a rectangular structure block.

The structure blocks are passed through one after the other from top to bottom.

Empty structure blocks are only permitted in branches.

Alternative terms: sequence, linear process, sequence.

Decision symbol

Alternative terms: branching, alternative, selection.

1 possible block

Easy selection

Instruction block 1 is run through ( if) only if the condition is applicable (true ). An instruction block can consist of one or more instructions. If the condition does not apply (false), the run is continued without any further instruction (exit below).

Alternative terms: conditional processing, simple selection / selection, simple branching.

2 possible blocks

Double choice

If the condition is true, statement block 1 is run through; if the condition does not apply (false), instruction block 2 is run through ( if then else). An instruction block can consist of one or more instructions. Exit below after processing the respective instruction block.

Alternative terms: single alternative, double choice, alternative branching / processing.

Example of nesting

Multiple choice

Another condition follows. Nesting is also still possible in the case of no.

Case statement


Particularly suitable for more than three conditions to be checked: The value of "Variable" can conditionally be checked for equality as well as for ranges (larger / smaller for numbers) and the correspondingly applicable "case" with the associated statement block is run through ( switch, select). A case selection can always be converted into a nested selection - for example if the programming language used later does not recognize case selections.

Alternative terms: multiple alternative, case selection, multiple selection, case, select.


Iteration symbol

Counter controlled loop

Repetition structure in which the number of runs is specified ( for). A counter variable must be specified as a condition and initialized with a start value. An end value and the (counting) step size must also be specified. After each run of the loop body (instruction block 1) the counter variable is incremented by the step size (or decremented if the step size is negative) and compared with the end value. If the end value is exceeded or not reached, the loop is exited.

Alternative terms: counter-controlled loop.

Begin-End symbol


These are loops like those found in PL / I and ALGOL . They are characterized by two conditions.

Alternative terms: repetition with conditional checking, checking loop.

Special case: End = true

Repellent (head controlled) loop

Repetition structure with a preceding conditional check ( while). The loop body (statement block 1) is only run through if (and as long as) the condition is true (true). This symbolism is also used for the counting loop (number of runs known).

Alternative terms: repetition with a preceding condition test, rejecting / pre-checking / head-controlled loop.

Special case: Begin = true

Repellent (foot-controlled) loop

Repetition structure with subsequent conditional check for termination ( loop). The loop body (statement block 1) is run through at least once, even if the condition was incorrect from the start!

Alternative terms: repetition with subsequent conditional test, non-repellent / checking / foot-controlled loop.

Special case: Begin = End = true

Infinite loop

Repetition structure that can only be left with an abort instruction ( break).

Alternative terms: repetition without a conditional check, endless loop.


Jump out

The exit ( break; also Exitcalled) represents the end of a part of the program. It should not be confused with the unconditional jump instruction ( goto) that Nassi and Shneiderman wanted to avoid with the structure diagrams.

Alternative terms: termination instruction, exit.

Block call


Symbol for calling a subroutine or a procedure , function or method . After it has run through, a jump is made back to the calling point and the next structure block is run through. This symbol is not standardized.

Parallel processing symbol


Symbol for the concurrent flow of several blocks.

Filling rules


Structograms should not contain any programming language-specific command syntax. They must be formulated independently of the programming language in such a way that the logic shown can be easily understood and implemented as a coding rule in any programming language.


Because they were originally developed for procedural programming languages, only the procedure and no declaration areas of variables and constants were shown in structograms (simple structogram). However, it is not immediately clear which data type must be assigned to a variable. The declaration of variables and constants is to be made in the first statement block. These Nassi-Shneiderman diagrams are then called extended structograms.


Each instruction has its own structure block (symbols according to DIN 66261). Even several statements of the same or similar type may not be combined in one structure block.

Each instruction must consist of at least one assignment (for example target variable  ←  target variable  *  other variable ). An assignment is shown by an arrow pointing to the left. Older structograms, from old Pascal times, use the colon followed by the equal sign as an alternative ( target variable  : =  target variable  *  other variable ). The target of an instruction is always to the left of the assignment symbol. To the right of this is the source.

A name belongs to each structogram in order to be able to guarantee the identification by event or (sub) program calls.

Practical relevance

In the software development Nassi-Shneiderman Diagrams are now used infrequently. There are primarily extended program schedules ( activity diagrams of UML ) is used.

Structograms are used in computer science lessons at upper secondary level so that students can train the development of logical processes that are necessary for programming. The creation of structure diagrams on the basis of descriptions of operational problems, which can be automated because the same procedure is repeated, is still part of many school final exams.

The program flow is determined directly in the EasyCODE development environment using Nassi-Shneiderman diagrams.

Nassi-Shneiderman diagrams can also be used in technical documentation .

Example diagrams

Simple structogram

The following example shows the sequence of the Euclidean algorithm for calculating the greatest common divisor of two numbers.

as a Nassi-Shneiderman diagram ... ... and in Python :
Example of a Nassi-Shneiderman diagram
def GGT(a, b):
    while a > 0 and b > 0:
        if a > b:
            a -= b
            b -= a

    if b == 0:
        return a
        return b

Extended structogram

as a Nassi-Shneiderman diagram ...

Example of an extended Nassi-Shneiderman diagram

... and the implementation in VBA :

  Option Explicit
  Private Sub btnZensur_Click()
    Dim intZensur As Integer, strZensur As String
    intZensur = InputBox("Geben Sie die Zensur als Zahl ein.")
    Select Case intZensur
       Case 1: strZensur = "sehr gut"
       Case 2: strZensur = "gut"
       Case 3: strZensur = "befriedigend"
       Case 4: strZensur = "ausreichend"
       Case 5: strZensur = "mangelhaft"
       Case 6: strZensur = "ungenügend"
       Case Else: strZensur = "ungültig"
    End Select
    MsgBox "Ihre eingegebene Zensur in Worten: " & strZensur
  End Sub

See also

Web links

supporting documents

  1. Nassi, I .; Shneiderman, B .: Flowchart Techniques for Structured Programming . SIGPLAN Notices XII. August 1973. Retrieved June 3, 2016.
  2. ^ Weiss, Edmond H .: Visualizing a Procedure with Nassi-Schneiderman Charts. Journal of Technical Writing and Communication , Vol. 20, No. 3 (1990): 237-254.