Nassi-Shneiderman diagram
DIN 66261 | |
---|---|
Area | programming |
title | Information processing; Symbols for structograms according to Nassi-Shneiderman |
Brief description: | Structograms |
Latest edition | 1985-11 |
ISO |
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
Instruction block 1 is run through ( Alternative terms: conditional processing, simple selection / selection, simple branching. |
2 possible blocks
If the condition is true, statement block 1 is run through; if the condition does not apply (false), instruction block 2 is run through ( Alternative terms: single alternative, double choice, alternative branching / processing. |
Example of nesting
Another condition follows. Nesting is also still possible in the case of no. |
Case statement
grind
Iteration symbol
Repetition structure in which the number of runs is specified ( 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
Repetition structure with a preceding conditional check ( Alternative terms: repetition with a preceding condition test, rejecting / pre-checking / head-controlled loop. |
Special case: Begin = true
Repetition structure with subsequent conditional check for termination ( Alternative terms: repetition with subsequent conditional test, non-repellent / checking / foot-controlled loop. |
Special case: Begin = End = true
Repetition structure that can only be left with an abort instruction ( Alternative terms: repetition without a conditional check, endless loop. |
Break
The exit ( 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
Generality
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.
declaration
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.
Exclusivity
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 : |
---|---|
def GGT(a, b):
while a > 0 and b > 0:
if a > b:
a -= b
else:
b -= a
if b == 0:
return a
else:
return b
|
Extended structogram
as a 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
- Literature on the Nassi-Shneiderman diagram in the catalog of the German National Library
- DIN 66261: Symbols for structograms according to Nassi-Shneiderman . Bielefeld University of Applied Sciences . Archived from the original on September 28, 2007. Retrieved June 2, 2016.
- sbide.de - Javascript-based structogram editor with C code generation and simulator for visualizing the program flow
supporting documents
- ↑ Nassi, I .; Shneiderman, B .: Flowchart Techniques for Structured Programming . SIGPLAN Notices XII. August 1973. Retrieved June 3, 2016.
- ^ Weiss, Edmond H .: Visualizing a Procedure with Nassi-Schneiderman Charts. Journal of Technical Writing and Communication , Vol. 20, No. 3 (1990): 237-254.