Business rules are a key ingredient for making business decisions. Which customers can be offered a higher credit limit? How much taxes to charge on a transaction? What purchases qualify for installment payments? These decisions require both the data (the parameters that will be evaluated) and the business logic (business rules) for evaluating the parameters.
Capturing business rules can get complicated. Traditional textual representation only works for straightforward rules and small number of variations. The more If-Then-Else constructs you have to use, the harder it will be to make textual representation clear and unambiguous. Just try reading some of the Terms and Conditions that you usually skip, or any the tax rules and regulations.
When we need to evaluate multiple conditions e.g. use a set of business rules to make a decision, two techniques – decision tables and decision trees – are useful to master.
A decision tree is preferred when each condition has no more than two or three outcomes. A business analyst skillful with this technique can become fast friends with the development team: a decision tree can be easily translated into the programming logic, and developers will appreciate the clarity and ease of validation.
From the stakeholders’ perspective, a decision tree may be easier to validate than a table, as the logic is visual. Only when the number of factors and possible values grows fast, the tree may become too wide and unmanageable, and then the decision table will be your other option.
So what exactly is a decision tree?
A decision tree is a visual map representing all paths to possible outcomes depending on a limited number of factors.
Here is a simple example depicting the logic you might follow when you need to borrow $1,000. Depending on how long you need the money for, and what is your credit history, you have a few decision options.
You can use a decision tree as a visual representation of a set of business rules that will show the path to each possible decision when a predefined set of factors is evaluated. A business analyst will need to discover and confirm:
- What factors are essential to making a decision (conditions)
- What are possible values of each decision factor (alternatives)
- What are possible outcomes (decisions)
- How each factor influences the outcome
Using these elements, create a decision tree following this structure:
There are several modelling notations used for decisions trees, and the shapes utilized to depict the nodes and leaves vary. You can choose any notation that your environment is accustomed to (or introduce your favourite notation), as long as you follow these best practices:
- A tree must start from one point but will have multiple end points – leaves (decisions).
- You can build a decision tree top down, as in the examples above, or left to right, with the leaves on the far right. Choose what is more suitable based on the number of branches and the depth of the tree.
- The order in which you apply conditions matters. Start with conditions that apply to most scenarios, and as you narrow down the scenario, use the conditions that are specific only to a particular branch of the tree.
- For each condition, ensure that all possible alternatives are included. Do not leave gaps and avoid overlaps – the alternatives must be mutually exclusive.
- Not all paths to the final outcomes need to be the same depth. Based on the conditions, some decisions can be reached with fewer evaluations.
- Make the labels on the tree brief and succinct. Drop articles and prepositions. No full sentences are required. All descriptions and clarifications can be provided below, as the focus of the tree should be on the logic and its direction. Follow the modelling best practices.
The beauty of decision trees is in the visible depiction of the logic. We can see how many conditions have to be evaluated, what are possible alternatives for each condition and what are possible outcomes. Once this information is captured visually, your stakeholders will find it easier to see what is missing or incorrect.
To practice creating decision trees, follow along with this video: