Announcing Cradle-7.7 - start your free trial here

3SL Reference - Structure Chart (STC)

Structure Chart (STC)

An STC shows a call hierarchy within a set of routines (procedures and functions) in a unit of source code. Each routine is shown by a module that is described in a code module. Structure Charts also show the parameters passed between the routines in their calls, using symbols called couples. Each couple is defined by a data definition in the Data Dictionary. Structure Charts can also show the global and shared data between these routines.

Cradle allows hierarchies of STCs which is useful in systems that have some degree of multi-processing or multi-tasking. One level of STC can be used to show the inter-process and inter-task communications, while lower-level(s) show the details of each task or process. For large systems, several levels of STC will be needed to reflect the number and complexity of the modules in the system, irrespective of whether multi-processing or multi-tasking is in use. Furthermore, the advent of packages in languages such as Ada also creates the need for more than one level of STC, where the higher-level(s) show the interactions between the package specifications (to use the Ada terminology) and lower-level(s) of STC are used to define the package bodies.

The relationships between modules are shown by calls. The existence and direction of the call indicates that a module has the means to call the other module and that, at runtime, the module may call the other module zero or more times.

Typically, the STC contains a hierarchy of modules with calls used to show how one module will call another. As module calls normally involve the passage and return of parameters (or arguments), the STC depicts these with couples. Data and control couples are provided that indicate the passage or return of an item of data or some value that controls the operation of the recipient module (such as a condition for a loop or test). The orientation of the couple indicates which module is sending the parameter, and which is receiving it. For parameters which are updated by a called module, use the dialog couple.

The data and control received and sent by a module in its input and output couples must be equivalent to the data and control received and sent by the collection of modules on the lower-level STC that the given module may have been expanded into.

The STC does not show sequence, so that an STC with a module M which has calls to three other modules A, B, and C drawn left-to-right below it, does not mean that M calls first A, and then B, and then C.

To avoid crossing calls, and for large systems, STCs provide named on-page connectors and off-page connectors. These allow calls between modules on the same or separate STCs to be shown as a pair of calls, one to the on-page or off-page connector, and the other from another on-page or off-page connector with the same name. Cradle treats calls through these connectors as though the two calls were one call. On-page and off-page connectors are supported by the Consistency Checker (CC) and Code Generator.

Tip: This means that couples are inherited across on-page connectors and off-page connectors. For example, a couple is required between modules A and B, but the call between these modules is split using off-page connectors, only a couple from A to the off-page connector need be drawn. It is not necessary to find the STC containing B and draw another couple from this off-page connector to B.

Off-page connectors provide a useful method of splitting a large STC into several smaller and more manageable diagrams that are linked, easily traversable, and exist at the same level. This flat structure is in contrast to decomposing the large diagram into a hierarchy, which may not be appropriate as then lower-level STCs would not necessarily contain greater detail.

STCs are only available in the Implementation Domain. STCs are hierarchical. Their connectivity is:

Diagram of the hierarchical connectivity of a Structure Diagram