Software Engineering CS 20006 Lecture 17 Design Tools

  • Slides: 25
Download presentation
Software Engineering CS 20006 Lecture 17 Design Tools and Techniques (Part-III)

Software Engineering CS 20006 Lecture 17 Design Tools and Techniques (Part-III)

Decision Table 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 2

Decision Table 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 2

Lecture #17 • Decision Table – Concepts and notations • Developing decision tables –

Lecture #17 • Decision Table – Concepts and notations • Developing decision tables – To prepare a decision table – To simplify a decision table – Understand application to SAD and Testing 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 3

Decision Table: Concept • A decision table is a tabular form that presents a

Decision Table: Concept • A decision table is a tabular form that presents a set of conditions and their corresponding actions • Decision tables are used to lay out in tabular form all possible situations which a business decision may encounter and to specify which action to take in each of these situations • For a project with complex decision making, decision table provides a systematic method Example Income tax calculation in Pay Roll Management system 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 4

Decision Table: Notation • A decision table is a table composed of two sections,

Decision Table: Notation • A decision table is a table composed of two sections, separated into four quadrants 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 5

Decision Table: An Example • What information you can derive from it? 11 March,

Decision Table: An Example • What information you can derive from it? 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 6

Developing Decision Tables • Issues 1. Determine the maximum size of the table 2.

Developing Decision Tables • Issues 1. Determine the maximum size of the table 2. Eliminate impossible situations, inconsistencies and redundancies 3. Simplify the table as much as possible 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 7

Decision Table Methodology • Steps 1. 2. 3. 4. 5. 6. Identify the number

Decision Table Methodology • Steps 1. 2. 3. 4. 5. 6. Identify the number of conditions Identify the number of condition alternatives Identify all possible actions Enter all possible rules Simplify the table Verify the table 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 8

A Sample Problem • A marketing company wishes to construct a decision table to

A Sample Problem • A marketing company wishes to construct a decision table to decide how to treat clients according to three characteristics: Gender, City Dweller and Age Group – – – • Gender: M, F City Dweller: Y, N Age Group: A (Young: under 30) B (Middle aged: between 30 and 40), C (Aged: over 60) The company has four products: W, X, Y and Z – – Product W will appeal to female city dweller Product X will appeal to young families Product Y will appeal to male middle aged shoppers who do not live in city Product Z will appeal all but older females 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 9

1. Identify the Number of Conditions Objective To decide the number of rows in

1. Identify the Number of Conditions Objective To decide the number of rows in the first section (condition stub) Three conditions in this problem: Gender City Dweller Age Group Maximum number of rows in condition stub = 3 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 10

1. Identify the Number of Conditions Objective To decide the number of rows in

1. Identify the Number of Conditions Objective To decide the number of rows in the first section (condition stub) NB: Combine rows that are overlap e. g. combine conditions that are mutually exclusive 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 11

2. Identify the Number of Conditions Alternatives Objective To decide the number of columns

2. Identify the Number of Conditions Alternatives Objective To decide the number of columns in the decision table The conditions alternatives in this problem: Gender with alternatives M and F City Dweller with alternatives Y and N Age Group with alternatives A, B and C Maximum number of columns in the table = product of alternatives for each condition Maximum number of columns in the table = 2 x 3 = 12 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 12

2. Identify the Number of Conditions Alternatives Objective To decide the number of columns

2. Identify the Number of Conditions Alternatives Objective To decide the number of columns in the decision table 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 13

3. Identify the Number of Actions Objective To decide the number of rows in

3. Identify the Number of Actions Objective To decide the number of rows in the Action stub Four actions are there in this problem: Product W Product X Product Y Product Z Maximum number of rows in action stub = 4 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 14

3. Identify the Number of Actions Objective To decide the number of rows in

3. Identify the Number of Actions Objective To decide the number of rows in the Action stub 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 15

4. Enter all Possible Rules Objective To define actions for all possible condition attributes.

4. Enter all Possible Rules Objective To define actions for all possible condition attributes. In this problem, action rules are: Product W ---- Female city dwellers Product X ----- Young females Product Y ----- Male middle aged and not City Dweller Product Z ----- All but older females 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 16

4. Enter all Possible Rules Objective To define actions for all possible condition attributes.

4. Enter all Possible Rules Objective To define actions for all possible condition attributes. Mark X in the decision table Product W ---- Female city dwellers Product X ----- Young females Product Y ----- Male middle aged who do not live in city Product Z ----- All but older females 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 17

5. Simplify the Table Objective Eliminate and/or consolidate rules to reduce the number of

5. Simplify the Table Objective Eliminate and/or consolidate rules to reduce the number of columns (Combine rules where it is apparent that an alternative does not make a difference in the column) Rules 2, 6 and 10 have two of the three condition values (Gender, City Dweller) identical all three of the values of the non-identical value (Age Group) are covered, so they can be considered into a single column 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 18

5. Simplify the Table (contd. . ) Objective Combine those columns into a single

5. Simplify the Table (contd. . ) Objective Combine those columns into a single column, which have all identical condition values except in one, and the exception condition should have all attribute values) Combining the rules 2, 6 and 10 into one, here is 2. We put a “-” for the values which non-identical. 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 19

5. Simplify the Table (contd. . ) Objective Two or more columns cannot be

5. Simplify the Table (contd. . ) Objective Two or more columns cannot be combined into one if it has no all attribute values for the indifferent condition Further, rules 4 and 12 have identical action pattern, but they cannot be combined because the indifferent attribute “AGE Group” does not have all its values covered in these two columns. In this case, “Age Group” B is missing. 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 20

5. Simplify the Table (contd. . ) Objective Eliminate the column which does not

5. Simplify the Table (contd. . ) Objective Eliminate the column which does not any action rule entries. Column 11 has no action entries, hence it should be eliminated. 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 21

6. Verify the Table Objective Look for redundancies (if two or more identical columns

6. Verify the Table Objective Look for redundancies (if two or more identical columns are there), contradictions and impossible situations, if any. If so eliminate them as appropriate No redundancies, contradictions or impossible situations in this case. The decision table is acceptable. 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 22

Applications of Decision Table • Complicated logic becomes more simpler – Developer can use

Applications of Decision Table • Complicated logic becomes more simpler – Developer can use it to code the problems with reduced error probability – Designer can check whether a design cater all possible scenarios – Easy to understand • Serve to verify and validate design and implementation • Decision table can be consulted to produce test cases while the system is under test 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 23

Problems to Ponder • What will happen if the conditions are arranged in different

Problems to Ponder • What will happen if the conditions are arranged in different order? How the condition attribute values will be arranged? • Assume that three conditions are there with condition attribute values are W X Y Z (Condition 1), A B C (Condition 2) and Y N (Condition 3). How would you distribute them in the “Action Entries” quadrants? • How the table can be adjusted, if certain decision making is changed? For example, in a new model “All Middle aged men live in the city”. How would you change this in the final table? • How you can accommodate if a new condition (or action) appears or delete? 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 24

Problems to Ponder • Work out the following table to construct an initial decision

Problems to Ponder • Work out the following table to construct an initial decision table. Obtain the simplified version of it. A student may receive a final course grade of A, B, C, D, or F. In deriving the student's final course grade, the instructor first determines an initial or tentative grade for the student, which is determined in the following manner: A student who has received a total of no lower than 90 percent on the first three assignments and exams and received a score no lower than 70 percent on the fourth assignment will receive an initial grade of A for the course. A student who has scored a total lower than 90 percent but no lower than 80 percent on the first three assignments and exams and received a score no lower 70 percent on the fourth assignment will receive an initial grade of B for the course. A student who has received a total lower than 80 percent but no lower than 70 percent on the first three assignments and exams and received a score no lower than 70 percent on the fourth assignment will receive an initial grade of C for the course. A student who has scored a total lower than 70 percent but no lower than 60 percent on the first three assignments and exams and received a score no lower 70 percent on the fourth assignment will receive an initial grade of D for the course. A student who has scored a total lower than 60 percent on the first three assignments and exams, or received a score lower than 70 percent on the fourth assignment, will receive an initial grade of F for the course. Once the instructor has determined the initial course grade for the student, the final course grade will be determined. The student's final course grade will be the same as his or her initial course grade if no more than 25% class periods during the semester were missed. Otherwise, the student's final course grade will be one letter grade lower than his or her initial course grade (for example, an A will become a B). Are there any conditions for which there was no action specified for the instructor to take? If so, what would you do to correct the problem? 11 March, 2020 Software Engineering (CS 20006) DSamanta, IIT Kharagpur 2020 25