SAC EXAMPLE 1
MODULARIZATION OF ALGORITHMS
(NOTE: This does not implement the OOSD paradigm; see the last extension.)

PART A: Example of Modularization without parameters

The following SAC, illustrates the simplest, and most fundamental type of modularized algorithm, the input-process-output sequence.  (a) Do a trace of the following algorithm.  (Assume that the value of the variable x is 100.  Use any value of A and B that you desire.)  (b) What does this algorithm do?

1"Trace" means to create a table of variable values for A, B, S, D, Q, and P and then pencil through the instructions of the SAC, placing the value of each variable, as it is assigned, under the column for that variable.

SAQ 1: What would the SAC of the unmodularized version of this algorithm look like?

PART B: Algorithm of PART A with parameters

The following SAC is a modification of the algorithm in Part A that incorporates the passing of data via parameters (OP1, OP2, OP3; IP1, IP2, IP3 and OP1, OP2, OP3, and OP4.)

SAQ 2: (a) What is the fundamental difference between the algorithms in PART A and PARTB?  (b) What fundamental danger does the alogorithm in PART B overcome?
SAQ 3: How would the algorithms in this example be modified to represent OOSD?  (b) Would the different versions of this algorithm have different OOSD versions?