Process Specification
Context of Process Specifications (Pspecs)
 Dataflow diagrams specify partioning
 Data dictionary defines all parts
 Pspecs provide specify processing logic
Goals for Process Specifications
 defines transformations from inputs to outputs for each
primitive process
 must be verifiable by the user and the systems analyst
 must be able to communicate to various audiences
(COBOL was the first language supposed to be
selfdocumenting)
 must be clear and unambiguous
 should be manageable (a page or less)
 should focus on behavior / be implementationindependent
(focus on what is done, not how)
Use the method(s) that best achieve(s) the goals.
Methods for Process Specifications
 structured English / Pseudocode
 pre/post conditions
 decision tables/trees
 flowcharts
 hybrid forms are combinations of the above
Sentences
of structured English (or pseudocode) consist of:
 Verbs/Actions

 GET/READ, PUT/WRITE, DISPLAY
 COMPUTE, ADD, SUBTRACT, MULTIPLY, DIVIDE
 DELETE, FIND, MOVE, REPLACE, SET, SORT
 ...
 Nouns/Objects

 elements known in the data dictionary
 local variables in terms of known elements
 Adjectives from Domain

 e.g., overdue, onreserve, ...
 Structured Programming Constructs

 IFTHENELSEENDIF
 CASE
 DOWHILE, REPEATUNTIL
 make your own: FOREACH X in LIST DO
 use structured programming style
(e.g., indentation, meaningful names)
 Not Used

 e.g., articles, prepositions, conjunctions,
noncontent words
Other Guidelines
 Use only standard or obvious control structures
 Avoid programming language punctuation
(but use parentheses to clarify order of operations)
 Indicate scope by reasonable means
(e.g., indentation, hierarchical numbering)
 Avoid complex conditions
(use a decision table instead)
Examples
NumberDaysLate = Today  DueDate
Fine = NumberDaysLate * PerDiemFine
IF DueDate > Today THEN
Fine = (DueDate  Today) * PerDiemFine
WHILE UserNotDone AND NOT TimedOut DO
ProcessUserRequest
 States the preconditions of what
conditions must be true for the function to work
(often in terms of relationships);
if the precondition is false, then the behavior
is undefined.
 States the postconditions of what
conditions will be true after the function
has completed its work.
 States what the function must do,
but not how it will do it.
 The function may be well understood,
or has been computed in a particular way
(e.g., by some software) for years.
 There might be many practical ways of
performing
the functions, and the choice may be
deferred
to the designer or programmer.
 It might be necessary to explore
implementation alternatives.
Types of Conditions
 inputs available / outputs produced
 relationships between inputs / outputs / stores
 Organizes complex decisions
(many possible outcomes)
 Based on several variables
(conditions),
 without implying any form of implementation.
General Form
 Condition Stub (list of conditions)
 Condition Matrix (combinations of conditions)
 Action Stub (list of actions)
 Action Matrix (actions to take, based on conditions)
Condition Stub  Condition Matrix

Action Stub  Action Matrix

Example...
_____________  1  2  3  4  5  6  7  8

Age>> 21 ____  Y  Y  Y  Y  N  N  N  N

Sex _________  M  M  F  F  M  M  F  F

Weight>> 150.  Y  N  Y  N  Y  N  Y  N

Medication 1.  X  _  _  _  X  _  _  X

Medication 2.  _  X  _  _  X  _  _  _

Medication 3.  _  _  X  _  _  X  _  X

No Medication  _  _  _  X  _  _  X  _

Constructing a Decision Table
 Identify conditions/variables and all values they can take on
(use ranges of values to create discrete classes)
 Calculate the number of combinations
product of number of values for each decision variable
 Identify all possible actions/decisions
 Create an empty decision table by listing all
conditions and decisions on left side,
and all combinations of decisions across top
 List all combinations of conditions in each column
 Identify the appropriate decision for each combination of
conditions
 Identify any problems (omissions, contradictions, ambiguities)
 Discuss any problems with the user and revise decision table
based on answers
Example Decision Table
Choosing a method for delivery
 Variables (conditions) [4*3*3*3 = 108]

 Destinations (local, city, state,
international) [4]
 Time table (day, week, month) [3]
 Weight (< 2 lbs, 210 lbs, 10+ lbs) [3]
 Insurance/value (< $10$100, $100$1000,
$1000+) [3]
 Shipping charges (compute rate and choose the
best)
 Carriers (actions)

 FedEx
 US Post
 UPS
 ConFreight
 US Lines
 Airplane
 Car
 Taxi
 Sequence of decisions leading to an action
 Each path through tree is a decision rule
 Useful when most cells in a decision table would be empty
Constructing a Decision Tree
 Identify all decision variables and possible values
this is the same as for decision tables
 Determine the number of rules
this is the same as for decision tables
 Generate the tree from left to right
 Attach independent actions to leaves
 Formulate questions to resolve problems
 Revise Decision Tree based on answers
 Consider pruning the tree
Generating the Tree
 Label the root with a decision variable
 Draw and label a branch for each value
 Use each decision point as a new root
 Repeat procedure with next variable
 Place actions at leaf nodes in tree
Example Decision Tree
Compute the roots of quadratic equation:
 y = a*x^2 + bx + c
 y = 0 > x = (b +/ sqrt (4ac)) / 2a
if ac < 0, imaginary roots
if a = 0, avoid division by 0 and y = bx+c, so x=c/b
? a = 0 ?
yes
? b = 0 ?
yes
? c = 0 ?
yes
x = 0
no
no solution
no
x = c/b
no
? ac < 0 ?
yes
imaginary roots
no
? c = 0 ?
yes
x = b/2a
no
tmp = sqrt (4ac)
x1 = (b + tmp) / 2a
x2 = (b  tmp) / 2a
Another format, with "yes" branches above and "no" branches below.
x = 0
? c = 0 ?
no solution
? b = 0 ?
x = c/b
? a = 0 ?
imaginary roots
? ac < 0 ?
x = b/2a
? c = 0 ?
tmp = sqrt (4ac)
x1 = (b + tmp) / 2a
x2 = (b  tmp) / 2a
IF simple transformations
THEN
Pseudocode (Structured English)
ELSE IF complex transformations using known algorithm
THEN
Pre/PostConditions
ELSE IF many decision variables
THEN
Decision Table
ELSE IF many combinations of actions
THEN
Decision Table
ELSE IF few decision variables
THEN
Decision Tree
ELSE IF need to check combinations of conditions with customer
THEN
Decision Table, possibly then converted to Decision Tree
END IF
From Perlman, Ohio State University, 1996