Jackson structured programming: Difference between revisions

Content deleted Content added
m v2.04 - Repaired 1 link to disambiguation page - (You can help) - Michael A. Jackson
MalnadachBot (talk | contribs)
m Fixed Lint errors - replaced obsolete center tags. (Task 12)
Line 79:
A simple operation is drawn as a box.
 
<{{center>|[[Image:Element Jackson.png|A box labeled 'A']]<br>An operation</center>}}
 
A sequence of operations is represented by boxes connected with lines. In the example below, A is a sequence consisting of operations B, C and D.
 
<{{center>|[[Image:JSP Sequence.png|A box labeled 'A' connected to three boxes below it labeled 'B', 'C' and 'D']]<br>A sequence</center>}}
 
An iteration is again represented with joined boxes. In addition the iterated operation has a star in the top right corner of its box. In the example below, A is an iteration iteration of zero or more invocations of operation B.
 
<{{center>|[[Image:JSP Iteration.png|A box labeled 'A' connected to a box labeled 'B' below it with a star in the top right corner]]<br>An iteration</center>}}
 
Selection is similar to a sequence, but with a circle drawn in the top right hand corner of each optional operation. In the example, A is a selection of one and only one of operations B, C or D.
 
<{{center>|[[Image:JSP Selection.png|A box labeled 'A' connected to three boxes below it labeled 'B', 'C' and 'D' each with a circle in the top right hand corner]]<br>A selection</center>}}Note that it in the above diagrams, it is element A that is the sequence or iteration, not the elements B, C or D (which in the above diagrams are all elementary). Jackson gives the 'Look-down rule' to determine what an element is, i.e. look at the elements below an element to find out what it is.
 
==A worked example==
Line 99:
With JSP, the first step is to describe the data structure(s) of a program's input stream(s). The program has only one input stream, consisting of zero or more ''runs'' of the same byte value. Here is the JSP data structure diagram for the input stream.
 
<{{center>|[[Image:JSP RLE input.png]]</center>}}
 
The second step is to describe the output data structure, which in this case consists of zero or more iterations of byte pairs.
 
<{{center>|[[Image:JSP RLE output1.png]]</center>}}
 
The next step is to describe the correspondences between the components of the input and output structures.
 
<{{center>|[[Image:JSP RLE correspondence.png]]</center>}}
 
The next step is to use the correspondences between the two data structures to create a program structure that is capable of processing the input data structure and producing the output data structure. (Sometimes this isn't possible. See the discussion of ''structure clashes'', below.)
 
<{{center>|[[Image:JSP RLE program.png]]</center>}}
 
Once the program structure is finished, the programmer creates a list of the computational operations that the program must perform, and the program structure diagram is fleshed out by hanging those operations off of the appropriate structural components.