Process Specification: 1. Motivation and Learning Goals
Process Specification: 1. Motivation and Learning Goals
Process Specification: 1. Motivation and Learning Goals
PROCESS SPECIFICATION
Contents
2. LEARNING UNIT 1
Structured English specification
3. LEARNING UNIT 2
Decision table based specifications
4. LEARNING UNIT 3
Detecting
-Incompleteness
-Ambiguity
-Contradictions
-Redundancy
in decision table specification
5. LEARNING UNIT 4
Eliminating redundancy in specifications
6. LEARNING UNIT 5
Decision trees for specifications
7. REFERENCES
PROCESS SPECIFICATION
MOTIVATION
LEARNING GOALS
PROCESS SPECIFICATION
Once a DFD is obtained the next step is to precisely specify the process.
Structured English, Decision tables and Decision Trees are used to describe
processes. Decision tables are used when the process is logically complex
involving large number of conditions and alternate solutions. Decision trees
are used when conditions to be tested must follow a strict time sequence.
STRUCTURED ENGLISH
Example:
if customer pays advance
then
Give 5% Discount
else
if purchase amount >=10,000
then
if the customer is a regular customer
then Give 5% Discount
else No Discount
end if
DECISION TABLE-EXAMPLE
else No Discount
ACTIONS
Give 5% Discount X X - -
Give No Discount - - X X
DECISION TABLE-EXPLANATION
Operators -Arithmetic : +, -, /, *
Relational : >, >=, <, <=, =, !=
Logical : and, or, not
Keywords : if, then, else, repeat, until, while, do, case,
until, while, do, case, for, search, retrieve, read, write
Delimiters – {, }, end, end if, end for
Give 5% Discount
Y Y Give 5% Discount
C1 C3
N Y N
No Discount
C2
N
No Discount
Case (variable)
Variable = P: { statements for alternative P}
Variable = Q: { statements for alternative Q}
Variable = R: { statements for alternative R}
None of the above: { statements for default case}
end case
Example : Total =0
for subject =1 to subject =5 do
total marks=total marks +marks(subject)
write roll no,total marks
end for
while condition do
{ statements in loop }
end while
EXAMPLE
EXAMPLE
A bank uses the following rules to classify new accounts
If depositor's age is 21 or above and if the deposit is Rs 100 or more,
classify the account type as A If the depositor is under 21 and the deposit
is Rs 100 or more, classify it as type B If the depositor is 21 or over and
deposit is below Rs 100 classify it as C If the depositor is under 21 and
deposit is below Rs 100 do-not open account
Identify Conditions: Age >= 21 Cl
Deposits >= Rs 100: C2
Identify Actions : Classify account as A, B or C
Do not open account
C1 : Age >= 21 Y N Y N
ACTIONS
A1: Classify as A X - - -
A2: Classify as B - X - -
A3: Classify as C - - X -
Action Stub
CONDITION
STUB CONDITION ENTRIES
ACTION
ACTION ENTRIES
STUB
• 4 Quadrants-demarcated by two double lines
• CONDITION STUB LISTS ALL CONDITIONS TO BE CHECKED
• ACTION STUB LISTS ALL ACTIONS TO BE CARRIED OUT
• LIMITED ENTRY DECISION TABLE:ENTRIES ARE Y or N or -.Y-
YES,N- NO,-IRRELEVANT(DON’T CARE)
• X against action states it is to be carried out.
• - against action states it is to be ignored.
• Entries on a vertical column specifies a rule
•order of listing actions important while order of listing conditions is not
important
•actions listed first carried out first
sequential execution of actions
•rules may be listed in any order
Interpretation
R1: If applicant sponsored and he has minimum qualifications
and his fee is paid –Send Admit letter
R2: If applicant sponsored and has minimum qualifications
and his fee not paid send provisional admit letter
ELSE: In all other cases send regret letter.The else rule makes a decision
table complete
R1 R2 R3 R4
C1 : Product code 1 1 1 1 1 2
C2 : Customer code A B A B C -
Rl R2 R3 R4 R5 R6
Cl : Product code = 1? Y Y Y Y Y N
C2: Customer code = A B A B C -
C3: Order amount < 500? Y Y N N - -
Go to table 2 X -
No promotion - X Advance to next X - - -
salary point
No promotion - X X -
Complete departmental Y
Course else
1 yr since last increment Y
1.Observe that one can branch between tables
2. Whenever complex rules are given it is a good idea to break them up into
manageable parts
Rl R2
Cl: x>60 Y -
C2:x<40 - Y
We can expand decision table by
replacing each –by Y & N
Al X -
A2 : - X
Cl: x>60 Y Y N Y
C2:x<40 Y N Y Y
A rule which has no – is an
Al X X - - Elementary rule
A2 : - - X X
LEARNING UNIT 3
If action specified for multiple identical rules are different then it is called
ambiguous specifications
DT2 has an ambiguity. Rules R11 and R22 are identical but have
different actions. Ambiguity may be apparent or real. It is said to be apparent
if the rule leading to the ambiguity is logically impossible
For example,(x>60)=Y and (x<40)=Y cannot occur simultaneously.
Thus in DT2 rules R11 and R22 are apparently ambiguous rules
Apparently ambiguous rules is not an error
If an apparently ambiguous specification is real then it is a
contradiction
For example : If C1:(X > 60) = Y and C2:(X > 40) = Y then
X = 70 will satisfy both inequalities.
As two actions are specified for (Cl = Y, C2 = Y) and they are
different the rule is really ambiguous and is called Contradictory
Specification.
C1 N Y
C2
? Al
N
Y A2 A1,A2
DT3:
Grade 10 9 8 7 ? ? ? ?
C1 C2
C3 NN NY YY YN
N 7 ? 9 8
? ? 10 ?
Y
Observe that the fact that the specification is incomplete is obvious in the
Decision table whereas the structured English specification seems complete
which is not.
DT4: DECISION TABLE-ARREARS MANAGEMENT
R1 R2 R3 R4 R5 R6
C1:Payment in current month Y N N - - -
>min.specified payment
C2:Payment in current month>0 - Y Y - N N
C3:Any payment in last 3 months - - - N Y Y
C4: Actual arrears > 3(min.
Specified payment per month) - Y N Y N Y
A1 : Send letter A X - - - - -
A2 : Send letter B - X - - - -
A3 : Send letter C - - X - - -
A4 : Send letter D - - - X - X
A5 : Send letter E - - - - X -
KARNAUGH MAP
C1C2
C3C4 NN NY YY YN
NN ? A3 A1 A1*
YY A4 A2 A1 A1A4*
C1
A5: x>m C2:x>0 C3:y>0
A3 C4:z>3m A1 m>0 A1A5*
YN C3,C4 independent of C1,C2 C1,C2 dependent
C1: Y C2: Y x>m, x>0 possible
C1: Y C2: N x>m, x<=0 not logically possible
C1: N C2: Y x<=m,x>0 possible
C1: N C2: N x<=m,x<=0 possible
Thus C1,C2,C3 C4:NNNN incomplete specification
BOXES MARKED * NOT LOGICALLY POSSIBLE
Rules C1 C2 C3 C 4 : NYNY and YYNY logical errors
Errors to be corrected after consulting users who formulated the rules
CORRECT DECISION TABLE
C1C2
C3C4 NN NY YY YN
NN A4 A3 A1
IMPOSSIBLE
NY A4 A4 A4 RULES
YY A4 A2 A1
A5 A3 A1
YN
C1 Y Y Y N N N N Y N N N N
C2 Y Y Y Y Y Y Y Y N N N N
C3 N Y Y Y N Y N N Y N N Y
C4 N Y N Y N N Y Y Y Y N N
Question: Can the number of rules be reduced?
Answer : Yes, by combining rules with the same action
LEARNING UNIT 4
REDUNDANCY ELIMINATION
C1C2
NN NY YY YN NN NY YY YN
C3 C4 C3 C4 NN NY YY YN C3 C4
A1 A1 A2 A2
NN NN NN
A1 A1 A2 A2 A3 A3
NY NY NY
A1 A1 A2 A2 A3 A3
YY YY YY
A1 A1 A2 A2
YN YN YN
A3=C1C2C3C4+C1C2C3C4+C1C2C3C4+C1C2C3C4
=C2C3C4(C1+C1)+C2C3C4(C1+C1)
=C2C4(C3+C3)=C2C4
NY A4 A4 A4
YY A4 A2 A1
YN A5 A3 A1
Boxes marked X correspond to impossible rules.
They can be employed if they are useful in reducing rules
A1 : C1C4+C1C3
A2 : C1C2C3C4
A3 : C1C2C4
A4 : C3C4+C2C3+C2C4
A5 : C2C3C4
REDUCING DECISION TABLES
A: Send letter A X X - - - - - -
B: Send letter B - - X - - - - -
C: Send letter C
EXAMPLE-REDUCTION OF RULES-IN WORD - -STATEMENT
X - - - -
D: Send letter D - - - - X X X -
E: Send letter
Rules E Driver if following rules are- satisfied
: Insure - - - - - - X
1.Drivers annual income > 20000 & is married male
2.Drivers annual income > 20000 & is married and over 30
3.Drivers annual income <= 20000 & she is married female
4.Driver is male over 30
5.Driver is married and age is not relevant
Else do not insure
Conditions:
C1 : Annual income > 20000
C2 : Male
C3 : Married
C4: Age > 30
Action: Insure or do not insure
A1:Insure X X X X X -
A2 :Do not insure - - - - - X
C1C2
NN NY YY YN
C3C
NN
NY A1 A1
A1=C3+C2.C4
YY A1 A1 A1 A1
A1 A1 A1 A1
YN
REDUCED DECISION TABLE
C2 : Male - Y
C3 : Married ELSE
Y -
C4 : Age > 30 - Y
Al : Insure X X -
A2 : Do not Insure LEARNING UNIT 5
- - X
C1
Book II AC
N Y
C2 Book sleeper
N Y
C3 Book sleeper
N Y
C4
N
Return
CONDITIONS
GRADE A
>=60
C GRADE B
>=50
GRADE C
>=40
else GRADE F
Sometimes Decision trees are more appropriate to explain to a user how
decisions are taken
ISOLATING
CONDITIONS & NOT GOOD BEST GOOD
ACTIONS
SEQUENCING
CONDITIONS BY GOOD NOT GOOD BEST
PRIORITY
CHECKING FOR
COMPLETENESS, NOT GOOD BEST NOT GOOD
CONTRADICTION
WHEN TO USE STRUCTURED ENGLISH,DECISION TABLES AND
DECISION TREES
Use Structured English if there are many loops and actions are complex
Use Decision tables when there are a large number of conditions to check
and logic is complex
REFERENCES
2. K.E. Kendall and J.E.Kendall, “Systems Analysis and Design”, 5th Edition,
Pearson Education Asia, Delhi, 2003. Has a brief discussion of structured
English, Decision Tables and Decision Trees (pages 353 to 369). Website
www.prenhall.com/kendall has a lot of support material and case study for
students.