“Our little systems have their day.”
-- Alfred, Lord Tennyson
In Memoriam, 1850
IN THIS CHAPTER, YOU WILL LEARN:
- How to write structured English process specifications;
- How to write process specifications with pre/post conditions;
- How to use decision tables to write process specifications; and
- When to use alternative specification tools.
In this chapter, we explore the process specification, the description of what’s happening inside each bottom-level, primitive bubble in a dataflow diagram. Various textbooks, including [DeMarco, 1978], and [Gane and Sarson, 1977] also use the term minispec (as an abbreviation for miniature specification) as an alternative for process specification. Regardless of its name, the purpose of a process specification is quite straightforward: it defines what must be done in order to transform inputs into outputs. It is a detailed description of the user’s business policy that each bubble carries out.
As we will see in this chapter, there is a variety of tools that we can use to produce a process specification: decision tables, structured English, pre/post conditions, flowcharts, Nassi-Shneiderman diagrams, and so on. While most systems analysts favor structured English, you should remember that any method can be used, as long as it satisfies two crucial requirements:
- The process specification must be expressed in a form that can be verified by the user and the systems analyst. It is precisely for this reason that we avoid narrative English as a specification tool: it is notoriously ambiguous, especially when describing alternative actions (decisions) and repetitive actions (loops). By its nature, it also tends to cause great confusion when expressing compound Boolean conditions (i.e., combinations of the Boolean operators AND, OR, and NOT).
- The process specification must be expressed in a form that can be effectively communicated to the various audiences involved. While it will typically be the systems analyst who writes the process specification, it will usually be a diverse audience of users, managers, auditors, quality assurance personnel, and others who must read the process specification. A process specification could perhaps be expressed in predicate calculus, or in Pascal, or in a formal diagramming approach such as Higher Order Software’s USE-IT<ref>For more information on USE-IT, see James Martin and Carma McClure’s Structured Techniques for Computing. (Englewood Cliffs, N.J.: Prentice-Hall, 1986).</ref>; but if the user community refuses to look at such specifications, they are worthless. The same may turn out to be true of decision tables, structured English or other specification tools, too; it is very much a function of the personality, background, and attitude of the users you deal with.
As mentioned above, most systems analysts use structured English as their preferred method of writing process specifications. It is perhaps more important to point out that most systems analysts, and most organizations, use one tool for writing all of their specifications.<ref>This is often caused by the introduction of an entire set of structured analysis standards in the organization. While the standards are an admirable effort to combat sloth, ignorance, and total anarchy, they often go too far and prescribe a rigidly regimented solution to all problems. As a common saying goes, “If your only tool is a hammer, all the world looks like a nail.”</ref> This is, in my opinion, a major mistake: you should feel free to use a combination of specification tools, depending on (a) the user’s preference, (b) your own preferences, and (c) the idiosyncratic nature of the various processes.
A good process specification tool should have a third characteristic, too: it should not impose (or imply) arbitrary design and implementation decisions. This is often very difficult, because the user, on whom we must depend for a statement of the “policy” carried out by each bubble in the DFD, is prone to describe the policy in terms of the way he carries it out today. It is your job as a systems analyst to distill from this presentation the essence of what the policy is, not how the policy is carried out today.
Consider the following example: the systems analyst is discussing a small fragment of a system, as illustrated by Figure 11.1. He wants to develop a process specification for the bubble labeled COMPUTE WIDGET FACTOR. Since the systems analyst is entirely unfamiliar with the application, he has interviewed the user and has learned that the policy for computing widget factors for any value of the input data element, x, is as follows:
- The widget factor is not produced as the result of a single calculation. In fact, we have to begin by making a guess. The user has told us that he is particularly fond of 14 as a first guess.
- Then we make another guess. We do this by dividing our current guess into the number, x, that we started with.
- We then take the result of this calculation and subtract it from the current guess.
- We then take the result of step 3, and divide it in half. This becomes our new guess.
- If the new guess and the current guess are pretty close to each other, say, within 0.0001, then we can stop; the new guess is the widget factor. Otherwise, go back to step 2 and do it all over again.
You might argue that this process specification is difficult to read and understand because it is written in narrative English. Indeed, the following description is much more compact (note that the vertical bars “|” in the UNTIL clause mean “absolute value of” the enclosed expression):
- widget-factor0 = 14
- REPEAT for N = 0 in steps of 1
- widget-factorN+1 = (widget-factorN - (X/widget-factorN))/2
- UNTIL |widget-factorN+1 - widget-factorN| < 0.0001
However, even this is flawed: it describes the policy in terms of a particular procedural implementation. The policy, as may have been evident (but equally likely, may not have been evident), is the Newton-Raphson algorithm for approximating a square root.<ref>Try the algorithm out on a couple of test cases. You’ll find that it converges fairly quickly.</ref> The following process specification describes the same policy, but leaves the designer/programmer complete freedom to choose her own algorithm:
- There exists a number X that is nonnegative.
- A widget-factor is produced such that
- X = widget-factor * widget-factor
The programmer may indeed choose to use the user’s algorithm for calculating the square root, but she should not be constrained to do so by the systems analyst. Indeed, the extravagant attention to the procedural algorithm, especially in the first version of the specification above, entirely obscured what the process really was!
Before we explore the various process specification tools, we should emphasize one point: process specifications are only developed for the bottom-level processes in a leveled set of dataflow diagrams. As we can see in Figure 11.2, all the higher-level processes are defined by the next lower-level network of processes. In other words, the process specification for a higher-level bubble is the lower-level DFD. To write an additional process specification in structured English would not only be superfluous, it would be redundant; that is, it would create a specification that would be more difficult to keep up to date.<ref>Notwithstanding this warning, we should point out that you will sometimes be required, as a systems analyst, to produce a written process specification for higher-level processes. This will happen if the user decides that he wants to show the specification to his boss and is concerned that the boss won’t tolerate the idea of leveled DFDs. Thus, the user will say to you, “Look, I know that you don’t need a process specification for these top-level bubbles, but I’d appreciate it if you would write them anyway so that the boss can understand what the system is all about.” You’ll have to deal with this problem with the same diplomatic skills that you use to solve all other political problems in your project.</ref>
We will concentrate on three major process specification tools in this chapter:
- Structured English
- Pre/post conditions
- Decision tables
We will also comment briefly on a number of other less commonly used specification tools: narrative English, flowcharts, and Nassi–Shneiderman diagrams.
Structured English, as the name implies, is “English with structure.” That is, it is a subset of the full English language with some major restrictions on the kind of sentences that can be used and the manner in which sentences can be put together. It is also known by such names as PDL (for program design language) and PSL (for problem statement language or problem specification language). Its purpose is to strike a reasonable balance between the precision of a formal programming language and the casual informality and readability of the English language.
A sentence in structured English may consist of an algebraic equation, for example
- X = (Y*Z)/(Q+14)
or a simple imperative sentence consisting of a verb and an object. Note that this sentence does not have the semicolon that terminates a programming statement in many different programming languages; it may or may not terminate with a period (“.”), depending on your taste in such things. Also, note that sentences describing computations can be prefixed with the verbs COMPUTE, ADD, SET, and so on; thus, we could have written the above example as
- COMPUTE X = (Y*Z)/(Q+14)
and we can have structured English computations like the following ones:
- SET TAX-RATE TO 13
- ADD 3 TO X
- MULTIPLY UNIT-PRICE BY QUANTITY
- DIVIDE CURRENT-ASSETS BY CURRENT-LIABILITIES.
Verbs should be chosen from a small set of action-oriented verbs such as:
- GET (or ACCEPT or READ)
- PUT (or DISPLAY or WRITE)
- FIND (or SEARCH or LOCATE)
Most organizations find that 40 to 50 verbs are sufficient to describe any policy in any process specification.
Objects (the subject of the simple imperative sentences) should consist only of data elements that have been defined in the data dictionary or local terms. Local terms are terms (words) that are explicitly defined within an individual process specification; they are only known, relevant, and meaningful within that process specification. A typical example of a local term is an intermediate calculation, which is used to produce the final output of the process.<ref>Local terms are defined within the process specification where they occur and arenot defined in the data dictionary. They are often derived (directly calculated) from terms that are already in the data dictionary, so it would be redundant to add the local terms. Also, by definition, the local terms are only known within a local context (i.e., inside a bubble in a dataflow diagram). They should not appear as a flow on the DFD, and they are usually not part of the normal vocabulary of application-oriented words used by the user.</ref> For example, the structured English process specification below examines a series of order records in an ORDERS store to compute a daily total:
- daily-total = 0
- DO WHILE there are more orders in ORDERS with Invoice-date = today’s date
- READ next order in ORDERS with Invoice-date = today’s date
- DISPLAY to Accounting invoice-number, customer-name, total-amount
- daily-total = daily-total + total-amount
- DISPLAY to Accounting daily-total
Finally, structured English allows sentences to be combined in a few limited ways; these are taken from the familiar structured programming constructs.<ref>If you are not familiar with structured programming, consult any of the standard texts on the subject, or see some of the early papers on the subject collected in [Yourdon, 1979].</ref>
- The IF-THEN-ELSE construct is used to describe alternative sentences that are to be carried out based on the result of a binary decision. The IF-THEN-ELSE construct can take either of the following two forms:
- IF condition-1
- IF condition-1
Thus, the systems analyst may write:
- IF customer lives in New York
- add customer to MARKETING-PROSPECTS
- IF customer-age greater than 65
- set billing-rate to senior-citizen-rate
- set billing-rate to normal-rate
- The CASE construct is used to describe alternative sentences to be carried out based on the results of a multivalued decision (as compared to the binary decision that takes place with an IF-THEN construct). The CASE construct takes the general form:
- DO CASE
- CASE variable = value-1
- CASE variable = value-n
Thus, the systems analyst might write:
- DO CASE
- CASE customer-age < 13
- set billing-rate to child-rate
- CASE customer-age ≥ 13 and customer-age < 20
- set billing-rate to teenage-rate
- CASE customer-age > 20 and customer-age < 65
- set billing-rate to adult-rate
- set billing-rate to senior-citizen-rate
- END CASE
Or, as another example, consider the following portion of a structured English process specification:
- DO CASE
- CASE state = “NY”
- set salestax to 0.0825
- CASE state = “NJ”
- set salestax to 0.07
- CASE state = “CA”
- set salestax to 0.05
- set salestax to 0
- END CASE
Note that the "OTHERWISE" clause is often used to catch situations that the user forgets to specify and that the systems analyst forgets to ask about; it will often prompt some discussions between user and systems analyst that would otherwise not take place until after the system had been put in operation. Consider the following example:
- DO CASE
- CASE payment-type = “cash”
- set discount-rate to 0.05
- CASE payment-type = “credit-card”
- set discount-rate to 0.01
- set discount-rate to 0
- END CASE
The user might question this process specification and ask why the systems analyst included the OTHERWISE clause; the systems analyst might respond by asking about payments by check, traveler’s check, gold coins, and barter.
- The DO-WHILE construct is used to describe a sentence that is to be carried out repetitively until some Boolean condition is true. It takes the general form:
- DO WHILE condition-1
The test (“condition-1” in the example above) is made before sentence-1 is carried out; thus, if the condition is not satisfied, it is possible that sentence-1 will be carried out zero times.
For example, the systems analyst might write:
- DO WHILE there are more items in the customer-order
- extended-price = unit-price * unit-quantity
Many organizations include another structure that carries out a specified sentence at least once before making a test to see if it should be repeated. This variation, usually known as the REPEAT-UNTIL construct, has the following form:
- UNTIL condition-1
Compound sentences can be built from combinations of simple sentences and the simple structures presented above, according to the following rules:
1. A linear sequence of simple sentences is equivalent (structurally) to a simple sentence. Thus, the sequence
is structurally equivalent to a single, simple sentence and can be substituted wherever a simple sentence is expected. This allows us to build structures like this:
- IF condition-1
- DO WHILE condition-1
2. A simple IF-THEN-ELSE construct is considered structurally equivalent to a single, simple sentence. This allows IF-THEN-ELSE structures to be nested within other IF-THEN-ELSE structures, or within DO-WHILE structures, or within CASE structures. For example:
- IF condition-1
- IF condition-2
- IF condition-3
3. A simple DO-WHILE structure is considered structurally equivalent to a simple, single sentence. This allows DO-WHILE structures to be nested within other DO-WHILE structures, or within IF-THEN-ELSE structures, or within CASE structures. Thus, we might have a structured English specification of the following nature:
- grand-total = 0
- DO WHILE there are more orders to process
- invoice-total = 0
- READ next order from ORDERS
- DO WHILE there are more items in the order
- invoice-total = invoice-total + item-amount
- DISPLAY invoice-number, invoice-total
- grand-total = grand-total + invoice-total
- DISPLAY grand-total
4. A simple CASE structure is considered structurally equivalent to a simple, single sentence. This allows CASE structures to be nested within other CASE structures, or within IF-THEN-ELSE structures, or within DO-WHILE structures.
As you can see, this allows us to construct arbitrarily complex descriptions of business policy, while maintaining strict control over the vocabulary, organization and structure of the description. However, this arbitrary complexity is also the major disadvantage of structured English: if the systems analyst composes a process specification that is too complex for the user to understand and verify, he has failed. This can usually be prevented by adhering to the following three guidelines:
- Restrict the structured English process specification to a single page of text (e.g., 8-by-11 sheet of paper, 66 lines of text on a word processing system, or 24 lines on a computer screen). If the specification takes more than one page, then the systems analyst (with the help of the user) should think of an entirely different way of formulating the policy (i.e., pick a different, simpler algorithm). If that cannot be done, then it is possible that the process itself (i.e., the bubble within the DFD) is too complex and should be split into a network of lower-level, simpler processes.
- Don’t allow more than three levels of nesting (i.e., three levels of nested IF-THEN-ELSE structures, or three levels of CASE structures, etc.). Particularly in the case of IF-THEN-ELSE structures, more than even two levels of nesting is a strong indication that a decision table specification would be preferable; this is discussed in Section 11.3.
- Avoid confusion about levels of nesting by using indentation, as shown in the examples above. This can be accomplished and controlled very easily if you are using any kind of automated support to develop the process specifications (even something as simple as a standard word processing system). If the process specifications are being typed manually by a clerical person who is not familiar with structured programming or structured analysis, you will have to explain very carefully what kind of indentation you want; you should also proofread the resulting text very carefully to see if it is correct.
Many systems analysts ask whether the user can be expected to read and understand a process specification written in structured English. My experience has been almost uniformly positive in this area: users can read structured English, with the following provisos:
- You will have to walk through the document once or twice to ensure that they understand the format and the various constructs. On the first reading, it may well look like a legal document, especially if you have “highlighted” the IF-THEN-ELSE construct, and the like.
- Don’t refer to the process specification as “structured English.” If necessary, refer to it as “a formal description of your business policy for carrying out this activity.”
Pay careful attention to the overall format and layout of the document; the indentation of nested blocks of logic is especially important. Some users prefer an outline style of indentation, that is, where indented levels are numbered 1.1, 1.1.1, 188.8.131.52, and so on.
Several examples of structured English process specifications are shown in the case study in Appendix F.
Pre/post conditions is a convenient way of describing the function that must be carried out by a process, without saying very much at all about the algorithm or procedure that will be used. It is a particularly useful approach when:
- The user has a tendency to express the policy carried out by a bubble in terms of a particular, idiosyncratic algorithm that he or she has been using for decades.
- The systems analyst is reasonably sure that there are many different algorithms that could be used.
- The systems analyst wants to let the programmer explore several such algorithms, but does not want to get involved in such details himself, and especially does not want to engage in arguments with the user about the relative merits of such algorithms.
An example of a process specification written with the pre/post condition approach is shown in Figure 11.3:
There are two main parts of the specification: pre conditions and post conditions. In addition, such specifications can contain local terms, as defined in the Structured English Section (see also footnote 5).
Preconditions describe all the things (if any) that must be true before the process begins operating. It’s sometimes convenient to think of the process as a “sleeping princess,” and the pre-conditions represent the “magic kiss” that will awaken the process and set it to work. Alternatively, you can think of the preconditions as a guarantee from the user: “I guarantee that when this process is activated the following things will be true.” Typically, the preconditions will describe the following:
- What inputs must be available. These inputs will arrive via a flow connected to the process, as shown on the dataflow diagram. Note that there may be cases where there are several flows coming into a process, but only one of the flows is a necessary precondition to activate the process. For example, if we saw a specification that began with
- data element X occurs
- associated with the dataflow diagram shown in Figure 11.4, we would interpret it as follows: the arrival of data element X is the activating stimulus that makes the process begin its work. As part of its work, it seeks input from dataflow Y or Z, or both, but Y and Z are not necessary for the process to begin doing its work.
- What relationships must exist between inputs or within inputs. Quite often a precondition will specify that two inputs with matching fields must arrive (e.g., order details and shipping details with the same account number). Or the precondition may specify that one component of an input data element be within a certain range (e.g., “an order with a delivery date more than 60 days in the future occurs”).
- What relationships must exist between inputs and data stores. A precondition might stipulate that there be a record within a store that matches some aspect of an input data element (e.g., the precondition might say, “There is a customer-order with customer-account-number matching a customer-account-number in the customers store”).
- What relationships must exist between different stores or within a single store. Thus, the precondition might say, “There is an order in the orders store whose customer-account-number matches the customer-account-number in the customers store.” Or the precondition might say, “There is an order within the orders store with a shipping-date equal to the current date.”
Similarly, the postconditions describe what must be true when the process has finished doing its job. Again, this can be thought of as a guarantee: “I guarantee that when the process is finished the following will be true.” Postconditions typically describe the following:
- The outputs that will be generated or produced by the process. This is the most common form of postcondition (e.g., “An invoice will be produced”).
- The relationships that will exist between output values and the original input values. This is common for the situation where an output is a direct mathematical function of an input value. Thus, a postcondition might say, “The invoice-total will be calculated as the sum of unit-item-prices plus shipping-charges.”
- The relationships that will exist between output values and values in one or more stores. This is common when information is to be retrieved from a store and used as part of an output of the process. For example, a process specification might have as a postcondition the following statement: “The on-hand-balance in the INVENTORY store will be increased by amount-received, and the new on-hand balance will be produced as output from this process.”
- The changes that will have been made to stores: new items added, existing items modified, or existing items deleted. Thus, we might see statements like “The order will be appended to the ORDERS store” or “The customer record will be deleted from the CUSTOMERS store.”
When building a pre/post condition specification, begin by describing the normal processing situations first. There may be several different normal situations (e.g., unique combinations of valid input/storage relationships) each of which is expressed as a distinct, separate precondition. For each such precondition, you should then describe the condition of the process bubble when the outputs have been produced and the stores have been modified. After the normal processing situations have been described, you should include appropriate preconditions and postconditions for error cases and abnormal cases. Consider the pre/post condition specification shown in Figure 11.5(b) that would be developed for a new system from the narrative specification in Figure 11.5(a).
Though the pre/post condition approach is quite useful and has a number of advantages, there are times when it may not be appropriate. The lack of intermediate steps between the inputs (preconditions) and the outputs (postconditions) is deliberate and conscious — but it may make the specification hard to understand if the reader cannot visualize some kind of procedure that will lead from inputs to outputs. Also, if there are complex relationships between inputs and outputs, it may be easier to write the specification using structured English. An example of a precondition/postcondition specification that is probably too complicated is shown in Figure 11.6.
As with all the forms of process specification, you should let your own judgment and the user's reactions guide you; if the user finds it difficult to read the precondition/postcondition specification, choose another format. The precondition/postcondition approach are shown in the case study in [Appendix G]; the alternative structured English approach is used in the case study in [Appendix F]. Look carefully at both case studies to determine the suitability of these two process specification tools.
There are situations where neither structured English nor pre/post conditions are appropriate for writing process specifications. This is particularly true if the process must produce some output or take some actions based on complex decisions. If the decisions are based on several different variables (e.g., input data elements), and if those variables can take on many different values, then the logic expressed by structured English or pre/post conditions is likely to be so complex that the user won’t understand it. A decision table is likely to be the preferred approach.
As shown in Figure 11.7, a decision table is created by listing all the relevant variables (sometimes known as conditions or inputs) and all the relevant actions on the left side of the table; note that the variables and actions have been conveniently separated by a heavy horizontal line. In this example, each variable is a logical variable, meaning that it can take on the value of true or false.
In many applications, it is easy (and preferable) to express the variables as binary (true-false) variables, but decision tables can also be built from multivalued variables; for example, one could build a decision table with a variable called “customer-age” whose relevant values are “less than 10,” “between 10 and 30,” and “greater than 30.”
Next, every possible combination of values of the variables is listed in a separate column; each column is typically called a rule. A rule describes the action (or actions) that should be carried out for a specific combination of values of the variables. At least one action needs to be specified for each rule (i.e., for each vertical column in the decision table), or the behavior of the system for that situation will be unspecified.
If there are N variables with binary (true-false) values, then there will be 2N distinct rules; thus, if there are 3 conditions, there will be 8 rules, and if there are 7 conditions, there will be 128 rules. Enumerating all the rules is a fairly straightforward process: by treating the Yes (or T) as a binary zero, and the No (or F) as a binary one, it is easy to generate a sequence of 000, 001, 010, 011, 100, 101, and so forth until all 2N combinations have been generated.<ref>Of course, there will be situations where the decision table conditions are not binary in nature, but are capable of taking on several values (e.g., an insurance application might involve customer-age and might use the values “under 18 years,” “18 through 64,” and “65 or over” ). To determine the total number of rules in such a decision table, we must multiply the number of values that variable 1 can take on by the number of values that variable 2 can take on by ... the number of values that variable N can take on. Thus, if we have an application where variable 1 can take on 3 values, variable 2 can take on 5 values, and variable 3 can take on 4 values, we will need 3 x 5 x 4 = 60 distinct rules.</ref>
You must discuss each rule with the user to ensure that you have identified the correct action, or actions, for each combination of variables. It is quite common, when doing this, to find that the user has never thought about certain combinations of variables or that they have never occurred in his or her experience.<ref>There are guidelines for simplifying decision tables and combining several rules into composite rules, but we will not cover them in this book. See [Yourdon, 1976] for details.</ref> The advantage of the decision table approach is that you can concentrate on one rule at a time.
Another advantage of the decision table approach is that it does not imply any particular form of implementation. That is, when the systems analyst delivers the decision table (along with the DFDs, etc.) to the designer/programmer, there is a tremendous freedom of choice in terms of implementation strategy: the decision table can be programmed with nested IF statements, with a CASE construct or a GO TO DEPENDING ON construct in COBOL; in the extreme case, a decision table code generator can automatically generate code from the decision table. Thus, decision tables are often referred to as a nonprocedural system modeling tool, for they do not require any specific procedural algorithm to carry out the required actions.
To summarize, we must go through the following steps to create a decision table for a process specification:
- Identify all the conditions, or variables, in the specification. Identify all the values that each variable can take on.
- Calculate the number of combinations of conditions. If all the conditions are binary, then there are 2N combinations of N variables.
- Identify each possible action that is called for in the specification.
- Create an “empty” decision table by listing all the conditions and actions along the left side and numbering the combinations of conditions along the top of the table.
- List all the combinations of conditions, one for each vertical column in the table.
- Examine each vertical column (known as a rule) and identify the appropriate action(s) to be taken.
- Identify any omissions, contradictions, or ambiguities in the specification (e.g., rules in the decision table for which the specification does not indicate that actions should be taken).
- Discuss the omissions, contradictions, and ambiguities with the user.
OTHER PROCESS SPECIFICATION TOOLS
Graphs and Charts
In some cases, it may be appropriate to express a process specification as a graph or a chart. Indeed, the user may already have a graph or a chart that is currently used to carry out that part of the application. If so, use it! There is no need for the systems analyst to translate a graph into structured English; instead, let the programmer translate the graph directly into COBOL, Visual Basic, or some other programming language when it is time to implement the system.
Consider, for example, a process specification that determines a customer’s insurance premium as a function of age. The user has told us that the current business policy is to determine the premium from the graph shown in Figure 11.8.
Assuming that the policy is not going to change when a new system is built, and assuming that the insurance premium is only a function of age, there is no need for the systems analyst to do any further work. Figure 11.8 is the process specification.
As we have implied several times in this chapter, narrative English is not a recommended tool for writing process specifications. This is because:
- An unrestricted vocabulary (i.e., indiscriminate use of nouns, verbs, and adjectives) makes it likely that the process description will include terms that are not in the data dictionary and whose meaning is not clear.
- Alternative actions (i.e., decisions) are often expressed in a clumsy, ambiguous fashion. This becomes even more dangerous when nested decisions are expressed.
- Repetitive actions (i.e., loops) are also expressed in a clumsy, ambiguous fashion. Nested loops are extremely dangerous when expressed in colloquial English.
- The concept of block structures can only be expressed with indentation or an outline-style presentation; if one is willing to go this far, one might as well use the formal structured English notation.
If, for some reason, you are forced to use narrative English, you should at least maintain some of the advantages of the highly partitioned structured analysis approach that we have discussed throughout this book. That is, under no circumstances should you allow yourself to be forced into the position of writing a 2000 page monolithic Victorian novel specification. At the very least, you should partition the specification into small pieces, so that you can write 2000 independent “short stories.”
We have avoided the use of flowcharts thus far in our discussion, but that is a reflection of current disinterest in flowcharts rather than an indictment of them.<ref>However, it is interesting to note that flowcharts may be about to experience a rebirth. Recent work by David Scanlan at California State University in Sacramento has shown that programming students strongly prefer flowcharts as the preferred method of learning about algorithms. If this is true for programming students, maybe it will be true for users, too. For more on this, see Scanlan’s paper entitled “A Niche for Structured Flowcharts,” Proceedings of the 1987 ACM Computer Science Conference.</ref> Much of the criticism of flowcharts has resulted from their misuse in the following two areas:
- As a high-level systems modeling tool, flowcharts suffer badly. A flowchart shows sequential, procedural logic; as we have seen in Chapter 9, a dataflow diagram is a more appropriate tool for modeling a network of asynchronous, communicating processes.
- There is nothing to prevent the systems analyst from creating an arbitrarily complex, unstructured flowchart of the sort shown in Figure 11.9.
However, if the flowchart is only used to describe detailed logic, and if the systems analyst restricts himself to flowcharting symbols equivalent to the structured English constructs described in Section 11.1, then there is nothing wrong with their use. To create a structured flowchart, the systems analyst must organize his or her logic with nested combinations of the flowchart symbols shown in Figure 11.10.<ref>For more information on structured flowcharts, see the classic paper [Böhm and Jacopini, 1966].</ref>
An alternative is the use of Nassi-Shneiderman diagrams, discussed in Section 11.4.4. However, it should be pointed out that very few systems analysts use flowcharts for process specifications (nor, for that matter, are they frequently used for program design either). Though the automated tools described in Appendix A could be used to create and maintain flowcharts, the simple truth is structured English, decision tables, and pre/post condition specifications are easier to create and maintain.
When structured programming first became popular in the mid-1970s, Nassi-Shneiderman diagrams were introduced as a structured flowcharting technique; see [Nassi and Shneiderman, 1973] and [Chapin, 1974]. A typical Nassi-Shneiderman diagram has the form shown in Figure 11.11.
Note that a simple imperative statement is represented by a rectangle, as shown in Figure 11.12(a); the rectangle can also be used to represent a block of sequential statements. The binary IF-THEN-ELSE construct is represented by the graphic notation shown in Figure 11.12(b); and the repetitive DO-WHILE construct is represented by the graphic notation shown in Figure 11.12(c).
The Nassi-Shneiderman diagrams are generally more organized, more structured, and more comprehensible than the typical flowchart; for that reason, they are sometimes preferred as a tool for creating process specifications. However, they do still require a nontrivial amount of graphics, and it is not clear that the graphics add that much value. As many systems analysts have been heard to mutter after spending an hour creating a Nassi-Shneiderman diagram, “This is just structured English with some boxes drawn around the statements!”
On the other hand, recent research conducted by David Scanlan at California State University ([Scanlan, 1987]) shows that 75% to 80% of computer science students strongly prefer Nassi-Shneiderman diagrams over pseudocode when learning about complex algorithms; although this does not agree with the typical negative reaction of experienced programmers toward flowcharts, Scanlan’s conclusions are based on careful factor-analytic studies of several hundred students. While end users do not necessarily have the same preferences as computer science students, there is at least the possibility that they would prefer a graphical representation of a process specification than a narrative/textual represenation.
The purpose of this chapter has been to show you that there are many different ways to describe the detailed user policy inside each primitive bubble in a dataflow diagram. While structured English is the most commonly used technique at the present time, you should consider the use of decision tables, flowcharts, pre/post conditions, or any other approach that can be verified and communicated easily to your users.
Keep in mind that the process specifications represent the largest amount of detailed work in building a system model; there may be hundreds or even thousands of process specifications, and each one may be a page in length. Because of the amount of work involved, you may want to consider the top-down implementation approach discussed in Chapter 5: begin the design and implementation phase of your project before all the process specifications have been finished.
Keep in mind also that the activity of writing process specifications serves as a “sanity test” of the dataflow diagrams that have already been developed. You may discover that the process specification needs additional input dataflows or that it produces additional output dataflows (i.e., flows that were not shown on the DFD). And as you write the process specification, you may find that additional functions are needed; for example, as you write the process specification for a function that adds a new record to the CUSTOMERS store, you may notice that the DFD does not have a bubble that modifies or deletes a record from that store. Thus, you should expect that changes, revisions, and corrections to the DFD model will be required based on the detailed work of writing the process specifications.
- Tom DeMarco, Structured Analysis and Systems Specification. Englewood Cliffs, N.J.: Prentice-Hall, 1979.
- Chris Gane and Trish Sarson, Structured Systems Analysis: Tools and Techniques. Englewood Cliffs, N.J.: Prentice-Hall, 1978.
- Edward Yourdon, Techniques of Program Structure and Design. Englewood Cliffs, N.J.: Prentice-Hall,1976.
- James Martin and Carma McClure, Diagramming Techniques for Software Engineering. Englewood Cliffs, N.J.: Prentice-Hall, 1985.
- Victor Weinberg, Structured Analysis. Englewood Cliffs, N.J.: Prentice-Hall, 1978.
- Edward Yourdon, Classics in Software Engineering. New York: YOURDON Press, 1979.
- Corrado Böhm and Guiseppe Jacopini, “Flow Diagrams, Turing Machines, and Languages with Only Two Formation Rules,” Communications of the ACM, Volume 9, Number 5 (May 1966), pp. 366-371. Also reprinted in Classics in Software Engineering (op. cit.).
- I. Nassi and B. Shneiderman, “Flowchart Techniques for Structured Programming,” ACM SIGPLAN Notices, Volume 8, Number 8 (August, 1973), pp.12-26.
- Ned Chapin, “New Format for Flowcharts,” Software -- Practice and Experience, Volume 4, Number 4 (October-December 1974), pp. 341-357.
- H. McDaniel, editor, Application of Decision Tables. Princeton, N.J.:, Brandon Systems Press, 1970.
- S. Pollack, H. Hicks, and W. Harrison, Decision Tables -- Theory and Practice. New York: Wiley, 1971.
- T.R. Gildersleeve, Decision Tables and Their Practical Applications in Data Processing. Englewood Cliffs, N.J.: Prentice-Hall, 1970.
- David Scanlan, “Cognitive Factors in the Preference for Structured Flowcharts: A Factor Analytic Study,” presented at the First Annual YOURDON Press Author’s Conference, New York, December 5, 1987.
QUESTIONS AND EXERCISES
- Consider the following specification, provided to you in a narrative form. Which of the specification tools presented in this chapter do you think would be the most appropriate? Why?
- “When I get a purchase order, my job is to pick a supplier from our file of available suppliers. Of course, some suppliers get eliminated right away because their price is too high, or because they’ve been temporarily “blacklisted” because of poor quality. But the real work that I do is to pick the optimal supplier from those that qualify -- the one that will deliver our order in the shortest amount of time. My boss had a system for estimating delivery time, and he taught it to me, but at this point I just look at the supplier’s location, the quantity of items being ordered, and the date that we need the goods, and I know which supplier will be the best one. ... I’m not even sure how I do it any more.”
- What is a process specification? What are its objectives?
- What are five common tools for modeling process specifications?
- What are the three requirements that a process specification should satisfy?
- Should a systems development project use one tool for process specifications? Why or why not?
- Research Project: Which specification tools are used in your organization? Are there restrictions on which tools are used? Do you think the right tools are in use?
- Which bubbles in a DFD require process specifications?
- What are the consequences of writing process specifications for nonatomic (nonprimitive) bubbles?
- How should the systems analyst determine what the process specifications for a bubble should be?
- How does it happen that process specifications sometimes impose arbitrary design and implementation decisions? What are the consequences of this?
- Research Project: Find an example of a process specification in your organization that exhibits arbitrary design or implementation decisions. How would you rewrite it to avoid this problem?
- Give a definition of the term structured English? What are some synonyms for this term?
- How many verbs are needed to form structured English sentences? Suggest a list of 20 verbs.
- Why are algebraic equations usually necessary in a structured English process specification?
- What characteristics should the objects in a structured English process specification have?
- What are local terms?
- Should local terms be included in a data dictionary? Why or why not?
- Do local terms appear as flows on DFDs?
- Give a specific example of a local term.
- What structured programming constructs are used in structured English?
- What is the purpose of the OTHERWISE clause in structured English?
- What is the difference between a DO-WHILE construct and a REPEAT-UNTIL construct in structured English?
- What is a compound sentence?
- Is the CASE construct necessary in structured English? What are the advantages and disadvantages of the CASE construct?
- What are the four components of a compound sentence?
- What is the difference between (a) and (b)?
- Which of the above two examples do you think is easiest to understand? Why?
- Research Project: Construct several examples similar to that in question 26, and conduct a survey among your users to see which version they prefer.
- What three guidelines should be followed to ensure that a structured English specification will be readable?
- Do you think that three levels of nested IF constructs in a structured English specification are OK? Why or why not?
- Research Project: Make up several examples of structured English process specifications involving two, three, and four levels of nested IF constructs. Conduct a survey to determine, on average, how many levels the users in your organization are willing to accept.
- What is the purpose of indentation in a structured English process specification?
- Why is it important to conduct walkthroughs of a structured English process specification with the appropriate user?
- What is the purpose of using outline-style numbering in a structured English process specification?
- Give a definition of the precondition/postcondition specification technique.
- What is the difference between the structured English specification technique and the precondition/postcondition technique?
- Under what conditions is the precondition/postcondition specification technique a good one for the systems analyst to use?
- Give a definition of a precondition.
- What are the four things that a precondition typically describes?
- What is the relationship between preconditions in a process specification and input flows on a DFD?
- What happens if the preconditions of a process specification are not satisfied?
- Give a definition of a postcondition.
- What are the four things that a postcondition typically describes?
- What is the relationship between postconditions and output flows on a DFD?
- If a process specification has four sets of preconditions, how many sets of postconditions should it have?
- What is the minimum number of preconditions that a process specification could have?
- What are the potential disadvantages of the precondition/postcondition approach?
- Research Project: Find an example of a real-world process specification that would not be well suited to the precondition/postcondition specification approach. Why is it not well suited?
- Look at Figure 11.6. What would be a better modeling tool for creating a process specification for this situation?
- Research Project: Find an example of a real-world process specification that would be well suited to the precondition/postcontion approach. Why is it well suited?
- What is a decision table? What are the components of a decision table?
- Under what conditions is a decision table a good modeling tool for process specifications?
- What is wrong with the following decision table?
- What is wrong with the following decision table?
- What is wrong with the following decision table?
- What is the difference between a decision table with binary variables and a decision table with multivalued variables?
- If a decision table has N binary-valued variables, how many rules should it have?
- Under what conditions should the systems analyst use a graph for a process specification?
- What are the advantages of a graph over structured English as a modeling tool for process specifications?
- What are the four major disadvantages of narrative English as a modeling tool for process specifications?
- What guidelines should be followed if narrative English must be used as a modeling tool for process specifications?
- What are the two common criticisms of flowcharts as a modeling tool?
- What are the three components of a structured flowchart?
- Research Project: Show the same specification to a user in the form of structured English and a flowchart. Which approach is preferred? For more information on this see [Scanlan, 1987].
- What is a Nassi-Shneiderman diagram? What is the difference between a flowchart and a Nassi-Shneiderman diagram?
- From Structured Analysis by Victor Weinberg (New York: YOURDON Press, 1978): Write a decision table for the following narrative specification, and indicate any omissions, ambiguities, or contradictions that you find:
- “The Swell Store employs a number of salesmen to sell a variety of items. Most of these salesmen earn their income from a commission, paid on the items they sell, but a few are salary-plus-commission employees; that is, they receive a fixed salary, regardless of the quantity or type of items they sell, plus a commission on certain items. The Swell Store sells several different lines of merchandise, some of which are known as standard items (a can of tomato soup, for example) because they are widespread and do not require any creative sales techniques; in addition, there are bonus items that are highly profitable but difficult to sell (a gold-plated, diamond-studded Cadillac, perhaps). The standard and bonus items generally represent the low and high ends of the price spectrum, sandwiching a greater number of items in the middle of the spectrum.
- “Customers, also, are categorized. Some are known as regulars, because they do business so often that no creative selling is required. Most of the customers, however, do a small amount of business at the Swell Store, and are likely to walk in right off the street, buy something, and then disappear forever.
- “The management’s commission policy is as follows: If a nonsalaried employee sells an item that is neither standard nor bonus to someone other than a regular customer, he receives a 10 percent commission, unless the item costs more than $10,000, in which case the commission is 5 percent. For all salesmen, if a standard item is sold, or if any item is sold to a regular customer, no commission is given. If a salaried salesman sells a bonus item, he receives a 5 percent commission, unless the item sells for more than $1,000, in which case he receives a flat $25 commission. If a nonsalaried salesman sells a bonus item to someone other than a regular customer, he receives a 10% commission, unless the item sells for more than $1,000, in which case he receives a flat commission of $75.”