Software Engineering-I : Analysis and design tools-Decision tree and decision tables

Analysis and design tools-Decision tree and decision tables

Whenever a system analyst or programmer is required to take a logical decision for the case where there are repetitive situations, then they take the help of the tools like decision table and decision tree that leads or concludes to the appropriate solution for the particular problem.

 DECISION TABLE

In order to find out solution of a problem which demands logical decision for the situation this involves various conditions and possible actions can be represented in form of table, called as decision table. Physical layout of decision table is as follows.
CASE 1: Consider a case of a bank which grants loan to the customer under the following conditions 
        1] If a customer has an account with the bank and has no previous loan outstanding, the loan will               be granted. 
        2] If a customer has an account with the bank but some amount is outstanding from previous loans             then new proposal’s loan will be granted if special management approval is there. 
       3] In all other situations loan applications are rejected. Draw decision table and decision tree for the             same. 
       Decision table: 1] List of conditions:- Customer has an account. 
                                                                   - Customer had no dues. 
                                                                    -Customer has management approval.
                                2] Action list:- 
                                                   Grant loans. 
                                                   Reject loans.

 DECISION TABLE TYPE

1. Limited Entry Decision Table  :

    This type of decision table expects ‘YES ’ or ‘NO’ answer for the condition statements as well as action statements are marked by symbols representing write or wrong. 
Case 2: The discount policy of a manufacturer producing two products 
                    1. Mechanical typewriter and 
                2. Electronic typewriter and who has three types of customers(R) Retailers,(D) Dealers,(I) institutes is given below. 
Rules: Incase of mechanical typewriter 
                 1] If the order is from retailer for amount up to Rs.5000/, allow 6% discount. 
                 2] If the order is from Dealer for amount up to Rs. 5000/ 7.5 discount is given. 
                 3] On retail order exceeding Rs. 5000/- 7.5 % discount is given. 
                4] If the order is from Dealer for an amount exceeding Rs.5000/-,11% discount is allowed. 
                5] In all the above cases flat discount of 7.5% is given to institutes. 
                6] In case of electronic typewriter a flat discount of 6% is given regardless of amount or                            customer. 
LIMITED ENTRY DECISION TABLE FOR DISCOUNT POLICY FOR CASE 2

2. Extended Entry Decision Table :

    In such type of decision table the statements made in stub portion are incomplete. Both the stub and entry portion of any particular row in the table must be considered together to decide if a condition or action is relevant to a given rule. An extended entry is either descriptive or quantified. 
    Now we will solve case number 2 by extended entry decision table method. 
    Extended Entry Decision Table For Case 2:- 

3.MIXED ENTRY DECISION TABLE :

Limited entry format and extended entry format can both be used in a single table for individual conditions and actions, where a table contain both types of formats is called as mixed entry decision table.

DECISION TREE

Decision tress is graphical representation of decision tables. Actually decision tables and decision trees are the means of expressing process logic. This tool is used especially when number of alternatives is less. Starting point of the decision sequence is the root of the tree which is shown at left hand side. The conditions and actions are represented sequentially, where the branches represent conditions and action for each relationship is given at the end of the branch.

ADVANTAGES: 
    1. Decision table is powerful tool of documentation that can be easily prepared, changed or updated. 
    2. DT is summarized form to represent standard and structured decisions. 
    3. It is a powerful mean of communication for the team working on project. 
    4. It can give relief up to certain extent to management from routine decision making procedure.

Ex. Decision tree for case-1 as