In this tutorial, we will demonstrate the use of decision table in representing the business rules of a store. In order to complete this tutorial, you need to have:
Layout of a Decision Table
A decision table is a two-dimensional matrix that composed of conditions, actions and rules, and is divided into four quadrants:
The quadrant of conditions contains rows of conditions that may affect the action to perform. The quadrant of actions lists out the actions that may be taken. Condition alternatives and action entries together represent a set of rules, with each rule (column) representing certain combination of conditions and actions.
Benefits of Using Decision Table
Decision table is particularly helpful when dealing with a large number of conditions, and when the conditions can be combined into a variety of situations.
- Able to group conditions regardless of their complexity, and present them in the simplest manner.
- Able to uncover all possible combination of conditions.
- Enables user to concentrate on a single rule out of all possibilities. This makes understanding business rules much easier than taking any other approaches.
Building a Decision Table
A store wants to run a discount campaign to attract new customers. The store owner decided to offer different discounts base on the following conditions:
- Customer is a youth customer (with age under 18)
- Customer is a member
- Transaction above $1,000
However, he has no idea about the amount of discounts to offer yet. He wants to find out the answer by developing a decision table. The result will be integrated into the store's ordering system.
Let's develop a decision table to show all the possible combinations of conditions and determine the amount of discounts to offer.
- Let's start by creating a new decision table. Select Diagram > New from the toolbar.
- In the New Diagram window, enter decision table in the search field, click Next.
- Then, fill in the Diagram Name and Description (if any). Click OK to confirm diagram creation.
- Add the conditions into the upper left quadrant of the decision table. You can add a condition by clicking the Add Condition button in the toolbar on top of the decision table.
Here, you have three conditions to add: Youth customer (Age > 18), Customer is a member, Transaction < $1,000.
- Determine the possible actions to be taken. Obviously one of the actions is Offer discounts. You can add multiple condition rows for each of the possible amount of discounts, i.e. Offer 10% discounts, Offer 20% discounts, etc. In this case, we take another approach. Add a single action Offer discount. We will specify the amount of discount directly in the table cells. This will be explained later in this tutorial.
- Besides offering discounts, the store owner also wants to convert customers who paid more than $1,000 to long-term members. This is achieved by inviting them to become members when they pay. So let's add an action Suggest membership. You can add an action by clicking the Add Action button in the toolbar of decision table.
- We are going to add rule columns to the decision table. There must be enough columns that can accommodate all the possible situations, formed by different unique combinations of conditions. In order to know the number of columns to be added, determine the number of alternatives for each condition first. In this case, there would be two alternatives (either Y or N) for each condition. The maximum number of columns is calculated by multiplying the number of alternatives for each condition. As there are three conditions and two alternatives each, there would be 8 set of conditions.
- Add 8 rule columns to the table. You can add a rule by clicking the Add Rule button in the toolbar of decision table.
- Fill in the condition alternatives to represent all the possible combinations of alternatives. "Y" is inserted for conditions that are met, "N" for not met.
- Before we move on to the conditions part of the table, let's review the rule columns and eliminate those invalid situations. According to the store's policy, membership is only available for adults. In other words, a customer cannot be both a youth and a member. Therefore, the combination of conditions reflected by rule 1 and 2 are mutually exclusive. Remove them.
- Now, study the situations one by one. Let's say 20% discount is offered for youth customer with transaction more than $1,000, enter 20% in the cell that intersects rule 1 and the Offer discount action.
- Only adults are allowed to become a member, so just leave the Suggest membership action unfilled.
- Study the other situations and complete the table. For the fifth rule, "X" is marked for the Suggest membership action to indicate that the customer will be invited to be a member.
- The decision table is basically completed. Check it for any invalid situations or redundancies. In this case, rule 3 and 4 can be combined because the amount of transaction does not affect the action to take. Let's combine them and replace the alternative of Transaction > $1000 with a dash, which signifies that the condition can be either Y or N and same set of actions will be taken.