MODULE 6 PROCESS SPECIFICATION

Similar documents
PROCESS SPECIFICATION

Software Engineering Prof.N.L.Sarda IIT Bombay. Lecture-11 Data Modelling- ER diagrams, Mapping to relational model (Part -II)

(Murlidhar Group of Institutions,Bhavnagar Road, Rajkot) by:-assit. Prof. Vijay Vora (SOOADM) MCA-III

CSE Information Systems 1

Further GroupBy & Extend Operations

PROGRAM DESIGN TOOLS. Algorithms, Flow Charts, Pseudo codes and Decision Tables. Designed by Parul Khurana, LIECA.

Checking Multiple Conditions

CHAPTER-2 STRUCTURE OF BOOLEAN FUNCTION USING GATES, K-Map and Quine-McCluskey

5. Selection: If and Switch Controls

Chapter VI: Process Analysis and Modeling

(Refer Slide Time 6:48)

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

SOFTWARE ANALYSIS & DESIGN TOOLS

Full file at

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2)

Kadi Sarva Vishwavidyalaya, Gandhinagar

Natural Language Specification

2 New Company Setup OBJECTIVES:

Darshan Institute of Engineering & Technology for Diploma Studies

INTERNAL ACCOUNTS SURVEY

REPRESENTING ALGORITHMS. REPRESENTING ALGORITHMS IB DP Computer science Standard Level ICS3U

Dr. Relja Vulanovic Professor of Mathematics Kent State University at Stark c 2008

Name Period Date MATHLINKS GRADE 8 STUDENT PACKET 3 PATTERNS AND LINEAR FUNCTIONS 1

Decision Control Structure. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan

Introduction to Computer Programming Using FORTRAN 77

Requirements Engineering

JME Language Reference Manual

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

Organisation and Presentation of Data in Medical Research Dr K Saji.MD(Hom)

These instructions allow you to create a payment or credit memo for a Vendor (payee) with one invoice or credit memo, using Document Level Accounting.

SOFTWARE TESTING UNIT-VI Logic Based Testing

Microsoft Excel Level 2

UNIT II Requirements Analysis and Specification & Software Design

Linear Programming Terminology

Boolean Algebra & Digital Logic

One of the most important areas where quantifier logic is used is formal specification of computer programs.

STRUCTURED SYSTEMS ANALYSIS & DESIGN

(Refer Slide Time 5:19)

Copyright PI Enterprizes All rights reserved

G Programming Languages - Fall 2012

Defining Data Items Conrad Weisert (2003)

Data Import Guide DBA Software Inc.

MAT 003 Brian Killough s Instructor Notes Saint Leo University

7. Relational Calculus (Part I) 7.1 Introduction

CENTRAL INSTITUTE OF TOOL DESIGN

Chapter 2 SYSTEMS TECHNIQUES AND DOCUMENTATION

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING

Data and Process Modeling

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

2015 ICPC. Northeast North America Preliminary

At the end of the chapter, you will learn to: Present data in textual form. Construct different types of table and graphs

Full file at

Information Science 1

Chapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1

Chapter 17. Fundamental Concepts Expressed in JavaScript

Practice Final Exam Solutions

3 Sponsoring Distributors

Homework #3 (Search) Out: 1/24/11 Due: 2/1/11 (at noon)

Software Design. Software design is a blueprint or a plan for a computerbased solution for system

Lecture 8. The Seven C s of Effective Communication I To compose a written or oral message you must apply certain communication principles.

To create a Commodity Level Multiple Invoice/Credit Memo, you must know or have the following;

Frequently Asked Questions ORDERING ON MYHERBALIFE.COM INDIA, January 2013

13/11/2017. Meltem Özturan misprivate.boun.edu.tr/ozturan/mis515

CHENNAI MATHEMATICAL INSTITUTE M.Sc. / Ph.D. Programme in Computer Science

Verification Overview Testing Theory and Principles Testing in Practice. Verification. Miaoqing Huang University of Arkansas 1 / 80

Purchase Order User Manual

Introduction. The Quine-McCluskey Method Handout 5 January 24, CSEE E6861y Prof. Steven Nowick

Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi

9/9/2017. If ( condition ) { statements ; ;

Intermediate representations IR #1: CPS/L 3. Code example. Advanced Compiler Construction Michel Schinz

A Small Permutation Group Engine by: Gregory Kip. COMS W4115 Programming Languages and Translators Prof. Stephen Edwards

Introduction to C Final Review Chapters 1-6 & 13

(Refer Slide Time: 1:43)

Frequently Asked Questions

Homework #6 (Constraint Satisfaction, Non-Deterministic Uncertainty and Adversarial Search) Out: 2/21/11 Due: 2/29/11 (at noon)

Financials Module: General Ledger

8.1 OVERVIEW OF THE INVENTORY MODULE ADDING NEW ITEMS...

6.034 Quiz 1, Spring 2004 Solutions

Mathematics. Linear Programming

Making Tables and Figures

Topic C. Communicating the Precision of Measured Numbers

Basic Definitions and Concepts Complement to the Prologue and to Chapter 1, Respecting the Rules

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

INTRODUCTION 1 AND REVIEW

Building Concepts: Moving from Proportional Relationships to Linear Equations

Managing Information in Organizations. Sharon A Cox. Chapter 14 Business Themes. Link 14.2 Building a Simulation Model. Modelling Systems Dynamics

Lab 8. Interference of Light

Section A. A grammar that produces more than one parse tree for some sentences is said to be ambiguous.

1 Tree Search (12 points)

1.1 Defining Functions

Contents. Chapter 3 Combinational Circuits Page 1 of 34

Points Addressed in this Lecture. Standard form of Boolean Expressions. Lecture 4: Logic Simplication & Karnaugh Map

Columnwise Formulations

Chapter 2 REXX STATEMENTS. SYS-ED/ Computer Education Techniques, Inc.

Experiment 4 Boolean Functions Implementation

1 Definition of Reduction

Chapter Two: Program Design Process and Logic

SELECTION. (Chapter 2)

Transcription:

MODULE 6 PROCESS SPECIFICATION Learning Units 6.1 Structured English specification 6.2 Decision table based specifications 6.3 Detecting -Incompleteness -Ambiguity -Contradictions -Redundancy in decision table specification 6.4 Eliminating redundancy in specifications 6.5 Decision trees for specifications

LEARNING GOALS In this module we will learn 1. How to use structured English to precisely specify processes 2. The terminology used in structured English 3. Terminology of decision tables and how it is used to specify complex logic 4. How to detect errors in decision table specifications 5. Terminology and use of decision trees 6. Comparison of structured English, decision tables and decision trees 1 of 54

MOTIVATION Before designing a system an analyst must clearly understand the logic to be followed by each process block in a DFD An analyst s understanding must be cross checked with the user of the information system. A notation is thus needed to specify process block in detail which can be understood by a user. 2 of 54

MOTIVATION Notation used must be appropriate for the type of the application to be modelled. Different notations are needed to represent repetition structures,complex decision situation and situations where sequencing of testing of conditions is important 3 of 54

MOTIVATION For complex logical procedures a notation is needed which can also be used to detect logical errors in the specifications. A tabular structure for representing logic can be used as a communication tool and can be automatically converted to a program. 4 of 54

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 process. 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. 6.1.1 Systems Analysis And Design 5 of 54

STRUCTURED ENGLISH Structured English is similar to a programming language such as Pascal It does not have strict syntax rules as programming language Intention is to give precise description of a process The structured English description should be understandable to the user 6.1.2 Systems Analysis And Design 6 of 54

STRUCTURED ENGLISH 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 end if else No Discount end if 6.1.3 Systems Analysis And Design 7 of 54

DECISION TABLE-EXAMPLE Same structured English procedure given as decision table CONDITIONS RULE1 RULE2 RULE3 RULE4 Advance payment made Y N N N Purchase amt >=10,000 - Y Y N Regular Customer? - Y N - ACTIONS Give 5% Discount Give No Discount X X - - - - X X 6.1.4 Systems Analysis And Design 8 of 54

DECISION TABLE-EXPLANATION Conditions are questions to be asked Y is yes, N is no & - is irrelevant A X against the action says the action must be taken A - against the action says the action need not be taken Rule 2 in decision table DISCOUNT states: if no advance payment and purchase amount >=10000 and regular customer then give 5% discount 6.1.5 Systems Analysis And Design 9 of 54

STRUCTURED ENGLISH Imperative sentences- Actions to be performed should be precise and quantified Good Example: Give discount of 20% Bad Example: Give substantial discount 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 6.1.6 Systems Analysis And Design 10 of 54

DECISION TREE-EXAMPLE The structured English procedure given in 6.1.3 is expressed as a Decision tree below Give 5% Discount Y Y Give 5% Discount C1 N Y C3 N No Discount C2 N No Discount C1: Advance payment made C2: Purchase amount >=10,000 C3: Regular Customer 6.1.7 Systems Analysis And Design Y = Yes N = No 11 of 54

STRUCTURED ENGLISH-DECISION STRUCTURES If condition then { Group of statements } else { Group of statements } end if Example: if(balance in account >= min.balance) then honor request else reject request end if 6.1.8 Systems Analysis And Design 12 of 54

STRUCTURED ENGLISH-CASE STATEMENT 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 : Case(product code) product code =1 : discount= 5% product code =2 : discount =7% None of the above : discount=0 end case 6.1.9 Systems Analysis And Design 13 of 54

STRUCTURED ENGLISH-REPETITION STRUCTURE for index = initial to final do { statements in loop } end for Example : Total =0 for subject =1 to subject =5 do total marks=total marks +marks(subject) write roll no,total marks end for 6.1.10 Systems Analysis And Design 14 of 54

STRUCTURED ENGLISH-WHILE LOOP while condition do { statements in loop } end while Example : while there are student records left to do read student record compute total marks find class write total marks, class, roll no end while 6.1.11 Systems Analysis And Design 15 of 54

EXAMPLE Update inventory file for each item accepted record do { search inventory file using item code if successful then { update retrieved inventory record; write updated record in inventory file using accepted record} else { create new record in inventory file; enter accepted record in inventory file} end if end for 6.1.12 Systems Analysis And Design 16 of 54

DECISION TABLE-MOTIVATION A procedural language tells how data is processed Structured English is procedural Most managers and users are not concerned how data is processedthey want to know what rules are used to process data. Specification of what a system does is non-procedural. Decision Tables are non-procedural specification of rules used in processing data 6.2.1 Systems Analysis And Design 17 of 54

ADVANTAGES OF DECISION TABLE Easy to understand by non-computer literate users and managers Good documentation of rules used in data processing. Simple representation of complex decision rules. Tabular representation allows systematic validation of specification detection of redundancy,incompleteness & inconsistency of rules Algorithms exist to automatically convert decision tables to equivalent computer programs. Allows systematic creation of test data 6.2.2 Systems Analysis And Design 18 of 54

METHOD OF OBTAINING DECISION TABLE FROM WORD STATEMENT OF RULES 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 6.2.3 Systems Analysis And Design 19 of 54

DECISION TABLE FROM WORD STATEMENT Condition Stub CODITIONS Rule 1 Rule 2 Rule 3 Rule 4 C1 : Age >= 21 Y N Y N C2: Deposit >=100 Y Y N N ACTIONS A1: Classify as A X - - - A2: Classify as B - X - - A3: Classify as C - - X - A4: Do not open Account - - - X Action Stub 6.2.4 Systems Analysis And Design 20 of 54

DECISION TABLE NOTATION EXPLAINED CONDITION STUB CONDITION ENTRIES ACTION STUB ACTION ENTRIES RULE 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 6.2.5 Systems Analysis And Design 21 of 54

DECISION TABLE NOTATION -CONTD ORDER OF LISTING CONDITIONS IRRELEVANT i.e. CONDITIONS MAY BE CHECKED IN ANY ORDER ORDER OF LISTING ACTIONS IMPORTANT ACTIONS LISTED FIRST CARRIED OUT FIRST SEQUENTIAL EXECUTION OF ACTIONS RULES MAY BE LISTED IN ANY ORDER 6.2.6 Systems Analysis And Design 22 of 54

INTERPRETING DECISION TABLE-ELSE RULE R1 R2 C1: Is applicant sponsored Y Y C2: Does he have min Y Y qualification C3: Is fee paid? Y N ELSE A1: Admit letter A2: Provisional Admit letter A3: Regret letter X - - - X - - - X 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 cases send regret letter.the else rule makes a decision table complete 6.2.7 23 of 54

DECISION TABLE FOR SHIPPING RULES R1 R2 R3 R4 C1: Qty ordered <= Quantity Y Y N N in stock? C2: (Qty in stock-qty ordered)<=reorder level N Y - - C3: Is the partial - - Y N shipment ok? A1:Qty shipped=qty ordered X X - - A2:Qty shipped=qty in stock - - X - A3:Qty shipped=0 - - - X A4:Qty in stock=0 - - X - A5:Back order=qty orderedqty shipped - - X X A6:Initiative reorder procedure A7: Qty in stock Qty in stock -Qty shipped - X X X X X - - 6.2.8 Systems Analysis And Design 24 of 54

EXTENDED ENTRY DECISION TABLE Condition Entries not necessarily Y or N Action entries not necessarily X or - Extended Entry Decision Tables(EEDT) more concise EEDT can always be expanded to LEDT Example R1 R2 R3 R4 R5 R6 C1 : Product code 1 1 1 1 1 2 C2 : Customer code A B A B C - C3 : Order amount <=500 <=500 >500 >500 - - Discount = 5% 7.5% 7.5% 10% 6% 5% 6.2.9 Systems Analysis And Design 25 of 54

MIXED ENTRY DECISION TABLE Can mix up Yes, No answers with codes Rl R2 R3 R4 R5 R6 Cl : Product code = 1? Y Y Y Y N C2: Customer code = A B A B C - C3: Order amount < 500? Y Y N N - - Discount = 5% 7 5% 7 5% 10% 6% 5% Choice of LEDT, EEDT, MEDT depends on ease of communication with user, software available to translate DTs to programs, ease of checking etc. 6.2.10 Systems Analysis And Design 26 of 54

LINKED DECISION TABLE Decision table 1 Salary point=6 N e Conduct OK? Y l Diligence OK? Y s Efficiency OK? Y e Go to table 2 X - No promotion - X Decision table3 Complete departmental Course 1 yr since last increment Advance to next salary point No promotion 6.2.11 Y Y else X - - X Decision table 2 Salary point>2 N N N Y 1 yr as class 1 Y N - - officer Departmental test Y - N - Passed? Advance to next salary point No promotion Go to Table3 X - - - - X X - - - - X 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 27 of 54

LOGICAL CORRECTNESS OF DECISION TABLE Consider decision table DTI: Rl R2 Cl: x>60 Y - C2:x<40 - Y Al X - A2 : - X We can expand decision table by replacing each by Y & N DT2: R11 R12 R21 R22 Cl: x>60 Y Y N Y C2:x<40 Y N Y Y Al X X - - A2 : - - X X A rule which has no is an Elementary rule DT2 is an Elementary Rule Decision Table (ERDT) 6.3.1 Systems Analysis And Design 28 of 54

LOGICAL CORRECTNESS OF DECISION TABLE (CONTD) A decision table with 1 condition should have 2 elementary rules Each elementary rule must be distinct Each elementary rule must have distinct action If a decision table with k conditions does not have 2 k rules specified it is said to be incomplete For example : DT2 does not have the elementary rule C1:N, C2:N. It is thus incomplete. If the decision table has the same elementary rule occurring more than once it is said to have multiplicity of specifications For Example:In DT2 The rule C1:Y,C2:Y occurs twice.thus it has multiplicity of specification 6.3.2 Systems Analysis And Design 29 of 54

LOGICAL CORRECTNESS OF DECISION TABLE (CONTD) If action specified for multiple identical rules are different then it is called ambiguous specifications DT2 has an ambiguity.rules R 11 and R 21 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 6.3.3 Systems Analysis And Design 30 of 54

LOGICAL CORRECTNESS OF DECISION TABLE (CONTD) 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. 6.3.4 Systems Analysis And Design 31 of 54

LOGICAL CORRECTNESS OF DECISION TABLE (CONTD) If all 2 k elementary rules are not present in a k condition decision table is said to be incomplete. DT2 (PPT 6.3.1) is incomplete as rule C1:N, C2:N is missing Rule C1=N, C2:=N is logically possible as C1=N is X<=60 and C2=N is X >= 40. A value of X = 50 will make C1=N,C2=N Thus DT2 has a real incomplete specification A decision table which has no real ambiguities or real incompleteness is said to be logically correct A decision table with logical errors should be corrected 6.3.5 Systems Analysis And Design 32 of 54

USE OF KARNAUGH MAPS KARNAUGH map abbreviated K-map is a 2 dimensional diagram with one square per elementary rule The k-map of DT2 is C2 C1 N Y? Al N Y A2 A1,A2 If more than one action is in one square it is an ambiguous rule If a square is empty it signifies incomplete specification 6.3.6 Systems Analysis And Design 33 of 54

USE OF KARNAUGH MAPS Structured English procedure: If carbon content<0.7 then if Rockwell hardness>50 then if tensile strength>30000 then steel is grade 10 else steel is grade 9 end if else steel is grade 8 end if else steel is grade 7 end if C1:Carbon content <0.7 C2:Rockwell hardness>50 C3 tensile strength>30000 Decision table-grading steel Y Y Y N Y N N N Y Y N N N Y Y N Y N N N Y Y N Y Grade 10 9 8 7???? 6.3.7 Systems Analysis And Design 34 of 54

KARNAUGH MAPS GRADING STEEL C1 C2 C3 N Y NN NY YY YN 7? 9 8?? 10? The 3 conditions are independent The decision table is thus incomplete Observe that in the Structured English specifications the incompleteness is not obvious 6.3.8 Systems Analysis And Design 35 of 54

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 - 6.3.9 Systems Analysis And Design 36 of 54

KARNAUGH MAP C1C2 C3C4 NN NN NY YY YN NY YY YN? A3 A1 A1* A4 A2A4 + A1A4 + A1A4* A4 A2 A1 A1A4* A5 A3 A1 A1A5* C1 : x>m C2:x>0 C3:y>0 C4:z>3m m>0 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 6.3.10 K Map for decision table 37 of 54

CORRECT DECISION TABLE If users say that for rules C1C2C3C4:NYNY AND YYNY (marked with + in k-map) the action is A4 and for C1C2C3C4:NNNN also it is A4, the corrected map is C3C4 NN NY YY YN C1C2 NN NY YY YN A4 A3 A1 A4 A4 A4 A4 A2 A1 A5 A3 A1 Impossible rules 6.3.11 Systems Analysis And Design 38 of 54

CORRECTED DECISION TABLE C1 Y Y Y N N N N Y N N N N C2 Y Y Y Y Y Y Y C3 N Y Y Y N Y N C4 N Y N Y N N Y Y N N N N N Y N N Y Y Y Y N N Action A1 A1 A1 A2 A3 A3 A4 A4 A4 A4 A4 A5 Question: Can the number of rules be reduced Answer : Yes, by combining rules with the same action Action A1 can be represented by the Boolean expression: C1C2C3C4 + C1C2C3C4 + C1C2C3C4 = C1C2C3C4 + C1C2C3 (C4+C4) =C1C2C3C4+C1C2C3 = C1C2C4 + C1C2C3 6.3.12 39 of 54

REDUNDANCY ELIMINATION Redundancy can be eliminated by systematically applying four identities of Boolean Algebra These identities are A + A=1 l.a = A A + A = A 1 + A = 1 K-map assists in identifying Boolean terms in which One or more variables can be eliminated K-map is constructed in such a way that two boxes which are physically adjacent in it are also logically adjacent 6.4.1 Systems Analysis And Design 40 of 54

KARNAUGH MAP REDUCTION C1 C2 NN NY YY YN C3 C4 A4 NN NY A4 C1 C2 C3 C4 NN NN NY NY YY YN A4 A4 A4 A4 YY YN A4=C1C2C3(C4+C4)=C1C2C3 YY YN A4=C3C4(C1C2+C1C2+C1C2+C1C2)=C3C4 Combining 2 adjacent boxes eliminates 1 variable Combining 4 adjacent boxes eliminates 2 variable Combining 8 adjacent boxes eliminates 3 variable First and last columns of k-map are logically adjacent First and last rows are also logically adjacent 6.4.2 Systems Analysis And Design 41 of 54

KARNAUGH MAP REDUCTION C1C2 C1C2 NN NY YY YN C3 C4 C3 C4 NN A1 A1 NN NN NY A1 A1 NY YY A1 A1 YY A1 A1 YN YN C1C2 NY YY YN C3 C4 NN NY YY YN A2 A2 A2 A2 NN NY A3 A3 A2 A2 A3 A3 YY A2 A2 YN A1=(C3C4+C3C4+C3C4+C3C4).(C1C2+C1C2)=C2(C3+C3)=C2 A2=(C1C2+C1C2)(C3C4+C3C4+C3C4+C3C4)=C2 A3=C1C2C3C4+C1C2C3C4+C1C2C3C4+C1C2C3C4 =C2C3C4(C1+C1)+C2C3C4(C1+C1) =C2C4(C3+C3)=C2C4 6.4.3 Systems Analysis And Design 42 of 54

REDUCING DECISION TABLES-USE OF K-MAP This is the K-map corresponding to DT of 6.3.12 C1C2 C3C4 NN NY YY YN NN A4 A3 A1 Boxes marked X correspond to impossible rules. They can be used if they are useful in reducing rules NY YY YN A4 A4 A4 A4 A2 A1 A5 A3 A1 Using k-map reduction rules we get A1 : C1C4+C1C3 A2 : C1C2C3C4 A3 : C1C2C4 A4 : C3C4+C2C3+C2C4 A5 : C2C3C4 6.4.4 Systems Analysis And Design 43 of 54

REDUCING DECISION TABLES REDUCED DECISION TABLE for DT of 6.3.12 C1: Payment in current month > min specified payment C2: Payment in current month>0 C3: Any payment in last 3 months C4: Actual arrears> 3(minimum specified payment per month) Y Y N N - - - - - - Y Y - N N N - Y Y - N N - Y N - Y N Y - Y N A: Send letter A B: Send letter B C: Send letter C D: Send letter D E: Send letter E X X - - - - - - - - X - - - - - - - - X - - - - - - - - X X X - - - - - - - - X 6.4.5 Systems Analysis And Design 44 of 54

EXAMPLE-REDUCTION OF RULES IN WORD STATEMENT Rules : Insure Driver if following rules are satisfied 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 6.4.6 Systems Analysis And Design 45 of 54

DECISION TABLE FOR INSURANCE RULES Cl : Annual income> 20000 C2: Male C3: Married C4: Age > 30 Y Y N - - E Y - N Y - L Y Y Y - Y S - Y - Y N E A1:Insure X X X X X - A2 :Do not insure - - - - - X C3C4 C1C2 NN NY YY YN NN NY YY YN A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1=C3+C2.C4 6.4.7 Systems Analysis And Design 46 of 54

REDUCED DECISION TABLE C2 : Male - Y C3 : Married Y - ELSE C4 : Age > 30 - Y Al : Insure A2 : Do not Insure X X - - - X Reduced rules : Insure if married or male over 30 Observe 5 rules simplified to 2 and 1 condition removed 6.4.8 Systems Analysis And Design 47 of 54

DECISION TREES Used when sequence of testing condition is important It is more procedural compared to Decision tables 6.5.1 Systems Analysis And Design 48 of 54

EXAMPLE DECISION TREE TO BOOK TRAIN TICKET Book by II AC on 4/8/04 if available else book by II AC on 5/8/04.If both not available book by sleeper on 4/8/04 if available else book on 5/8/04 by sleeper.if none available return. C1 Y N C2 Y N C3 Book II AC Book II AC Book sleeper Book ticket N Y C1: Is II AC ticket available on 4/8/04 C4 C2: Is II AC ticket available on 5/8/04 N C3: Is sleeper available on 4/8/04 Return C4: Is sleeper available on 5/8/04 Observe in the tree sequencing of conditions which is important in this example Y 6.5.2 Systems Analysis And Design 49 of 54

DECISION TREES Decision trees are drawn left to right Circles used for conditions Conditions labelled and annotation below tree Conditions need not be binary For example: >=60 GRADE A C1 >=50 >=40 else GRADE B GRADE C GRADE F Sometimes Decision trees are more appropriate to explain to a user how decisions are taken 6.5.3 Systems Analysis And Design 50 of 54

DECISION TREES Decision tree for decision table of 6.2.9 [Slide number 25] C1 C2 C1: PRODUCT CODE C2 : CUSTOMER CODE C3: ORDER AMOUNT >500? 1 2 A B C YES C3 NO YES C3 NO Discount=7.5% Discount=5% Discount=10% Discount=7.5% Discount=6% Discount=5% Observe that the 3 alternatives for connection C2 shown as three branching lines SOME PEOPLE FIND DECISION TREE EASIER TO UNDERSTAND 6.5.4 Systems Analysis And Design 51 of 54

DECISION TREES Decision tree equivalent of structured English procedure of 6.3.7 (SLIDE 37) is given below NO Grade 7 C1 YES C1 C1 : Carbon < 0.7 C2 : Rockwell hardness > 50 C3: Tensile strength > 3000 NO YES C1 NO YES Grade 8 Grade 9 Grade 10 Observe incompleteness evident in the equivalent Decision Table is not evident in the Decision tree If the testing sequence is specified and is to be strictly followed the Decision tree is simple to understand. 6.5.5 Systems Analysis And Design 52 of 54

COMPARISON OF STRUCTURED ENGLISH, DECISION TABLES AND DECISION TREES CRITERION FOR COMPARISON STRUCTURED ENGLISH DECISION TABLES DECISION TREES ISOLATING CONDITIONS & ACTIONS NOT GOOD BEST GOOD SEQUENCING CONDITIONS BY PRIORITY GOOD NOT GOOD BEST CHECKING FOR COMPLETENESS, CONTRADICTIO N & AMBIGUITIES NOT GOOD BEST GOOD 6.5.6 Systems Analysis And Design 53 of 54

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 Use Decision trees when sequencing of conditions is important and if there are not many conditions to be tested 6.5.7 Systems Analysis And Design 54 of 54